From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D83D6EB64D9 for ; Thu, 29 Jun 2023 11:10:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232262AbjF2LKF (ORCPT ); Thu, 29 Jun 2023 07:10:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232177AbjF2LJk (ORCPT ); Thu, 29 Jun 2023 07:09:40 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADCF8294E for ; Thu, 29 Jun 2023 04:09:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1688036950; x=1719572950; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=Dt51Frbc0VtpgKsRkoOje6ipINA90raC3oWM4OnSZKU=; b=WUiuah0w5Gq9nhxaN7UTxQllcv7lgi4UHpWTHrtT6Yt403QJIOhFyxIS bVpNyFhbcdzqtvWJWjup6aEfnpmWb/ngBJG2UexPvYWUQmzXCYOLqWX9U OVCrLf3+OuM72rPEDqb1OnHsUKASaSRjcu3L52akLdTEvWsqNR30lVdPc keHJxtyyJbwxelteIC9CQ/UMil2ZvgfaX/UV9zmdbwJiLw56K2LTZEJr5 eYaCVc3v1VGeQEJwOcUg2JTewKlXCXdTgQzcW+yz9BCVAb0m2M+EB5B5r MqKFPIRMR4f05Ve/5rsCNVm7bcMnETJJEw0/aZJQldxkVKEoauw5yaIRG Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10755"; a="362118837" X-IronPort-AV: E=Sophos;i="6.01,168,1684825200"; d="scan'208";a="362118837" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2023 04:09:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10755"; a="861890475" X-IronPort-AV: E=Sophos;i="6.01,168,1684825200"; d="scan'208";a="861890475" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga001.fm.intel.com with ESMTP; 29 Jun 2023 04:09:08 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1qEpWM-000ps9-1A; Thu, 29 Jun 2023 14:09:06 +0300 Date: Thu, 29 Jun 2023 14:09:06 +0300 From: Andy Shevchenko To: Mark Brown Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Oder Chiou , Liam Girdwood , Jaroslav Kysela , Takashi Iwai Subject: Re: [PATCH v1 2/3] ASoC: rt5677: Use device_get_match_data() Message-ID: References: <20230629104603.88612-1-andriy.shevchenko@linux.intel.com> <20230629104603.88612-3-andriy.shevchenko@linux.intel.com> <33d3ba54-e391-454f-942c-67f498711078@sirena.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <33d3ba54-e391-454f-942c-67f498711078@sirena.org.uk> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 29, 2023 at 11:56:10AM +0100, Mark Brown wrote: > On Thu, Jun 29, 2023 at 01:46:02PM +0300, Andy Shevchenko wrote: ... > > + rt5677->type = (enum rt5677_type)(uintptr_t)device_get_match_data(dev); > Double casts, always a sign of a successful simplification! :P Unfortunate of the C language and use of plain numbers when pointers are required. :-( I feel your pain. > > + if (rt5677->type == 0) > > return -EINVAL; > > - } I would prefer to see in the ID table something like .compatible = "foo", .data = &codec[RT5677], but in this driver it seems it will require quite a refactoring. -- With Best Regards, Andy Shevchenko