Message ID | 20231006152739.3495671-1-andriy.shevchenko@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a888:0:b0:403:3b70:6f57 with SMTP id x8csp410267vqo; Fri, 6 Oct 2023 08:28:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFdc5PVP374YvTBbJjzG/78V0AB+PenDFXzYKM0pgDAN1CK8hhRrKlCv6WgOVvrrqqe6gZX X-Received: by 2002:a05:6830:3d09:b0:6be:fcc2:a3f5 with SMTP id eu9-20020a0568303d0900b006befcc2a3f5mr8395193otb.37.1696606088561; Fri, 06 Oct 2023 08:28:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696606088; cv=none; d=google.com; s=arc-20160816; b=0sqIaZqfSdjoiHYwkL9UCvl/zXt8rv5xb7OmNAm/IgDGbS1jNTEB1sW+58+hULS/P3 vgaSM6DO0duvZ1pHy+553EYgnXLTFY0Rw9VYKlLjuJwgqcp/xduJzdWTd4lHurV80+i4 OliDPGWOEguGYU4yiuyhG/GUo7tTWFX7AvS+Y2M7iYoRCqu/JYzC4mtAlRIIZNbIq28D qOGiNgu2tWCoTytBvioICEdSuwbeHCTw3JtYBKyvhHQ0QDf95yW9Sx4/Wx2ym7YEQzDe 7vLczxL/2M1BESTcWMdVOqHYa7Tn7Ul25Mug/cgx7m5ENOtn013VzqHLkwa/xhZaiteD Gl7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=as36YvE42gCaAtB3iWplllaco/1fX93pP2asIEcNK/Q=; fh=I4X5A/upTxjr4MJUWiwyG90hiFVpRAn8rF3FrSssWXo=; b=UwmV0Cv0KSwNdywZTI0S+s/cv85+hFExXuuD0MVYdyOaFJwpg/iCVKTZ0SHgY1Cjg7 zO02/BW6wa8AgDYXuKv0m5QWg9KQrgImcXb0XPz9JnuroKuCS0T7wjYuLsJndjIN0EyW yv5Rw02lmqnR+PjsGNO6UmL4N5c6c5Xd0XXxF1Lm3FTXOZMqHYyZO7q8BqsEBR6eZSCt kd5DJYXKlAjgl7B16YW+O3DCs4UaAt0q3+qxVFVjhQL52svokDM2z8u3e1C5YWBkonDL 3qXEk8SfjN6xzUdohHX6PDPbzRleG5rOe4DwVtOMKgsXeDMitjBN3F3bHlGTKxC5IOh2 owhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Czk29Vnc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id c6-20020a633506000000b00584a4a5be67si3982035pga.520.2023.10.06.08.28.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 08:28:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Czk29Vnc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 4DE09822AE70; Fri, 6 Oct 2023 08:28:06 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232810AbjJFP1r (ORCPT <rfc822;ezelljr.billy@gmail.com> + 18 others); Fri, 6 Oct 2023 11:27:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232803AbjJFP1q (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 6 Oct 2023 11:27:46 -0400 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 572D29E; Fri, 6 Oct 2023 08:27:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696606065; x=1728142065; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=bf77ZdZ1uTgln+hS23JadGI3L2QVcO3kDUNslRuZ4Yk=; b=Czk29VncDmdNmvjbnrXGj3Ucp+97uZ/sndLc84S/wLBDxC23Tdz46HMp KRTEfR+j3AgGU9hSky9wS405oculK6GIe/8AlPmk1p6iWTd2ilzSXMkLf SQLPTwm1k0yIzGuSOOvQOIv/rExQq/1OJYCur/37aMatyjbWQVRshAaRw q5IEQPIVR3jMQpFNMLgj5GQUAi5TneM4ikRAVY5GULlKFzUHG79ViXoih UkiCOInpWRgm0BWL6Tr0lDTyCsGU+oBpogafCpLc35lubKMt3gcecdWCN IkGyEJKX9i+q81gec3pxaHIZo6WIBFbNXNMiOlFIqVJr3T7lD6jr9DxRb g==; X-IronPort-AV: E=McAfee;i="6600,9927,10855"; a="2374454" X-IronPort-AV: E=Sophos;i="6.03,204,1694761200"; d="scan'208";a="2374454" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Oct 2023 08:27:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10855"; a="781687049" X-IronPort-AV: E=Sophos;i="6.03,204,1694761200"; d="scan'208";a="781687049" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga008.jf.intel.com with ESMTP; 06 Oct 2023 08:27:42 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 3577E430; Fri, 6 Oct 2023 18:27:41 +0300 (EEST) From: Andy Shevchenko <andriy.shevchenko@linux.intel.com> To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>, acpi4asus-user@lists.sourceforge.net, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Corentin Chary <corentin.chary@gmail.com>, =?utf-8?q?Jo=C3=A3o_Paulo_Rec?= =?utf-8?q?hi_Vita?= <jprvita@gmail.com>, Hans de Goede <hdegoede@redhat.com>, =?utf-8?q?Ilpo_J=C3=A4rvinen?= <ilpo.jarvinen@linux.intel.com>, Mark Gross <markgross@kernel.org> Subject: [PATCH v2 1/1] platform/x86: asus-wireless: Replace open coded acpi_match_device() Date: Fri, 6 Oct 2023 18:27:39 +0300 Message-Id: <20231006152739.3495671-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Fri, 06 Oct 2023 08:28:06 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779020425705015668 X-GMAIL-MSGID: 1779020425705015668 |
Series |
[v2,1/1] platform/x86: asus-wireless: Replace open coded acpi_match_device()
|
|
Commit Message
Andy Shevchenko
Oct. 6, 2023, 3:27 p.m. UTC
Replace open coded acpi_match_device() in asus_wireless_add().
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: fixed compilation error
drivers/platform/x86/asus-wireless.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
Comments
Hi, On 10/6/23 17:27, Andy Shevchenko wrote: > Replace open coded acpi_match_device() in asus_wireless_add(). > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > --- > v2: fixed compilation error > drivers/platform/x86/asus-wireless.c | 10 +++------- > 1 file changed, 3 insertions(+), 7 deletions(-) > > diff --git a/drivers/platform/x86/asus-wireless.c b/drivers/platform/x86/asus-wireless.c > index abf01e00b799..8b9a0dde34e3 100644 > --- a/drivers/platform/x86/asus-wireless.c > +++ b/drivers/platform/x86/asus-wireless.c > @@ -148,13 +148,9 @@ static int asus_wireless_add(struct acpi_device *adev) > if (err) > return err; > > - for (id = device_ids; id->id[0]; id++) { > - if (!strcmp((char *) id->id, acpi_device_hid(adev))) { > - data->hswc_params = > - (const struct hswc_params *)id->driver_data; > - break; > - } > - } > + id = acpi_match_device(device_ids, adev); > + if (id) > + data->hswc_params = (const struct hswc_params *)id->driver_data; > if (!data->hswc_params) > return 0; Thanks, but the error checking looks a bit weird now. How about: id = acpi_match_device(device_ids, adev); if (!id) return 0; data->hswc_params = (const struct hswc_params *)id->driver_data; That seems to better convey what the code's intention is. Regards, Hans p.s. This driver really should be converted to not be an acpi_driver instead it should bind to the instantiated platform_device for the adev, but that would require someone with actual hw access to test the conversion ...
On Fri, Oct 06, 2023 at 05:32:10PM +0200, Hans de Goede wrote: > On 10/6/23 17:27, Andy Shevchenko wrote: > > + id = acpi_match_device(device_ids, adev); > > + if (id) > > + data->hswc_params = (const struct hswc_params *)id->driver_data; > > if (!data->hswc_params) > > return 0; > > Thanks, but the error checking looks a bit weird now. How about: > > id = acpi_match_device(device_ids, adev); > if (!id) > return 0; > > data->hswc_params = (const struct hswc_params *)id->driver_data; > > That seems to better convey what the code's intention is. Indeed, otherwise the hswc_params seems to stay NULL anyway (due to kzalloc() use). I'll send a v3 with your suggestion being incorporated, thank you!
diff --git a/drivers/platform/x86/asus-wireless.c b/drivers/platform/x86/asus-wireless.c index abf01e00b799..8b9a0dde34e3 100644 --- a/drivers/platform/x86/asus-wireless.c +++ b/drivers/platform/x86/asus-wireless.c @@ -148,13 +148,9 @@ static int asus_wireless_add(struct acpi_device *adev) if (err) return err; - for (id = device_ids; id->id[0]; id++) { - if (!strcmp((char *) id->id, acpi_device_hid(adev))) { - data->hswc_params = - (const struct hswc_params *)id->driver_data; - break; - } - } + id = acpi_match_device(device_ids, adev); + if (id) + data->hswc_params = (const struct hswc_params *)id->driver_data; if (!data->hswc_params) return 0;