Message ID | 20231006153152.3502912-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 x8csp412834vqo; Fri, 6 Oct 2023 08:32:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IExRdpOsJHJruHwR5v/M19CfmIgCA1G0bINjv8i50C0yY0iYP1R/EG6ggF4PTWdaBQ8uxHR X-Received: by 2002:a17:90b:4f8c:b0:268:b66b:d9f6 with SMTP id qe12-20020a17090b4f8c00b00268b66bd9f6mr7633218pjb.18.1696606332582; Fri, 06 Oct 2023 08:32:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696606332; cv=none; d=google.com; s=arc-20160816; b=EDE+YU8tXHn8Wx5EV1GtACVF3vqd8vA/3ZT5zwAoHLxjjy0UDlQYjnQhHKSr44YFYr IDObSG4BMwsCcFP/bhThi7uXjMmRg0/77KFTU9oC+xSOipXKNyfKNy8jI6pM8pwk65O9 eSyeqLlh/eslMaPQAcAphmTdUxB/L+ZX76tfCKWp0UobBJnhMFLxcuKgzwBwZ8INePJV fHc8LGmt2W+3Du6bZpRGE4XJocRzSQaIseYfsKiEl+NVhcuELJ0PbFVkhavclmOb5E5A BA6Vhql7lF2bnKswFmX3cMMY+Z2Nnqjw/NRr4hclfA92e8/mVSfe2pdvrR6YX4LVO+PH efwg== 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=3/Ttsjkupcskdv4i6ja3I/c0M7w6QvhUcT7IR45yqTI=; fh=jaqDfav+Fqf+dCO4uouVZhSNUOSqYncYVT5kOkD7Zmc=; b=FiI4hC35L33YUN0CsL9DPgBO+HfO/NEYQZh6LyX6aVEK7Gg+xWnDaLApREOaA4ftxc a2WS83qyus4Zx035gjS/U9Od/XmX9iawmMNE27l5q67+RqV5dVcuWaJbN5RPhyf4Dp43 zakjzN3fjoNI19bjBhsQVSjxeVgGJpRCmpF7ZTRXLIUg36YdvrCOSTutS5sAj6TAmeTS zVbsvRv/FHcETQMXKjjqFCBnZSW/TNqYExHVVwEUgaB4tGo+Cz8CH7uo/5o31gzvfNWp W97p/GSQEp6RwharvPauQvZp8VmfwUq30kjyjYVSCx5/ePlpBTAL5z83o64sxBDE3g9C g5IQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=I1Wp94G1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id f13-20020a170903104d00b001c5bab14164si3705118plc.60.2023.10.06.08.32.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 08:32:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=I1Wp94G1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 2F79C8319233; Fri, 6 Oct 2023 08:32:07 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232812AbjJFPcB (ORCPT <rfc822;ezelljr.billy@gmail.com> + 18 others); Fri, 6 Oct 2023 11:32:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232718AbjJFPb7 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 6 Oct 2023 11:31:59 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50EE49E; Fri, 6 Oct 2023 08:31:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696606318; x=1728142318; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=6+Wehx1uF41hZpIjafvQpHKPc68H7L87dFNCBaLztcE=; b=I1Wp94G1x69nIf+d4Fd2+rKPBSDnDJXQP3TQRcNg1L5CePhq4krsBGPx xhmuVsWcKjWhcrUJA0QE+eKSf6xyZ9j7Agwftfrez11ghJ4d5bGR429M4 fcMDTN0s3Ubg8XplpjzU0si0TtFxAgpXDfBGODjjajS4UbSScylqraOd7 r+ah0ZGldOW0dw9UaY/2WRVMHgHGdSR3soJ60LYPYXHQzA8bxE4P+gxAg atU8eBI+25RLPZLt/XuOmKPd0kN4hUjWlIeVkh03s54czkzhXhbo3t5pm V4oEJ+7iR0oObS3bVFAQwYJtHSRC9/8THRFGyeRFVbGsYMzYNNrA7tJFZ g==; X-IronPort-AV: E=McAfee;i="6600,9927,10855"; a="470038700" X-IronPort-AV: E=Sophos;i="6.03,204,1694761200"; d="scan'208";a="470038700" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Oct 2023 08:31:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10855"; a="702087014" X-IronPort-AV: E=Sophos;i="6.03,204,1694761200"; d="scan'208";a="702087014" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga003.jf.intel.com with ESMTP; 06 Oct 2023 08:31:54 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id C891F430; Fri, 6 Oct 2023 18:31:53 +0300 (EEST) From: Andy Shevchenko <andriy.shevchenko@linux.intel.com> To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Cc: 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: xo15-ebook: Replace open coded acpi_match_device() Date: Fri, 6 Oct 2023 18:31:52 +0300 Message-Id: <20231006153152.3502912-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.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Fri, 06 Oct 2023 08:32:07 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779020681966146968 X-GMAIL-MSGID: 1779020681966146968 |
Series |
[v2,1/1] platform/x86: xo15-ebook: Replace open coded acpi_match_device()
|
|
Commit Message
Andy Shevchenko
Oct. 6, 2023, 3:31 p.m. UTC
Replace open coded acpi_match_device() in ebook_switch_add().
Note, while it is a bit longer it is more robust in case
more IDs will be added.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: fixed compilation error
drivers/platform/x86/xo15-ebook.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
Comments
Hi, On 10/6/23 17:31, Andy Shevchenko wrote: > Replace open coded acpi_match_device() in ebook_switch_add(). > > Note, while it is a bit longer it is more robust in case > more IDs will be added. > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Thanks, patch looks good to me: Reviewed-by: Hans de Goede <hdegoede@redhat.com> Regards, Hans p.s. This driver too 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 ... > --- > v2: fixed compilation error > drivers/platform/x86/xo15-ebook.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/drivers/platform/x86/xo15-ebook.c b/drivers/platform/x86/xo15-ebook.c > index 391f7ea4431e..2ae8a58adcd0 100644 > --- a/drivers/platform/x86/xo15-ebook.c > +++ b/drivers/platform/x86/xo15-ebook.c > @@ -81,9 +81,9 @@ static SIMPLE_DEV_PM_OPS(ebook_switch_pm, NULL, ebook_switch_resume); > > static int ebook_switch_add(struct acpi_device *device) > { > + const struct acpi_device_id *id; > struct ebook_switch *button; > struct input_dev *input; > - const char *hid = acpi_device_hid(device); > char *name, *class; > int error; > > @@ -102,8 +102,9 @@ static int ebook_switch_add(struct acpi_device *device) > name = acpi_device_name(device); > class = acpi_device_class(device); > > - if (strcmp(hid, XO15_EBOOK_HID)) { > - pr_err("Unsupported hid [%s]\n", hid); > + id = acpi_match_device(ebook_device_ids, device); > + if (!id) { > + dev_err(&device->dev, "Unsupported hid\n"); > error = -ENODEV; > goto err_free_input; > } > @@ -111,7 +112,7 @@ static int ebook_switch_add(struct acpi_device *device) > strcpy(name, XO15_EBOOK_DEVICE_NAME); > sprintf(class, "%s/%s", XO15_EBOOK_CLASS, XO15_EBOOK_SUBCLASS); > > - snprintf(button->phys, sizeof(button->phys), "%s/button/input0", hid); > + snprintf(button->phys, sizeof(button->phys), "%s/button/input0", id->id); > > input->name = name; > input->phys = button->phys;
Hi Andy, kernel test robot noticed the following build errors: [auto build test ERROR on linus/master] [also build test ERROR on v6.6-rc4 next-20231006] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/platform-x86-xo15-ebook-Replace-open-coded-acpi_match_device/20231006-233327 base: linus/master patch link: https://lore.kernel.org/r/20231006153152.3502912-1-andriy.shevchenko%40linux.intel.com patch subject: [PATCH v2 1/1] platform/x86: xo15-ebook: Replace open coded acpi_match_device() config: i386-buildonly-randconfig-003-20231007 (https://download.01.org/0day-ci/archive/20231007/202310070210.fA8JzLkG-lkp@intel.com/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231007/202310070210.fA8JzLkG-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202310070210.fA8JzLkG-lkp@intel.com/ All errors (new ones prefixed by >>): drivers/platform/x86/xo15-ebook.c: In function 'ebook_switch_add': >> drivers/platform/x86/xo15-ebook.c:105:50: error: passing argument 2 of 'acpi_match_device' from incompatible pointer type [-Werror=incompatible-pointer-types] 105 | id = acpi_match_device(ebook_device_ids, device); | ^~~~~~ | | | struct acpi_device * In file included from drivers/platform/x86/xo15-ebook.c:17: include/linux/acpi.h:712:69: note: expected 'const struct device *' but argument is of type 'struct acpi_device *' 712 | const struct device *dev); | ~~~~~~~~~~~~~~~~~~~~~^~~ cc1: some warnings being treated as errors vim +/acpi_match_device +105 drivers/platform/x86/xo15-ebook.c 81 82 static int ebook_switch_add(struct acpi_device *device) 83 { 84 const struct acpi_device_id *id; 85 struct ebook_switch *button; 86 struct input_dev *input; 87 char *name, *class; 88 int error; 89 90 button = kzalloc(sizeof(struct ebook_switch), GFP_KERNEL); 91 if (!button) 92 return -ENOMEM; 93 94 device->driver_data = button; 95 96 button->input = input = input_allocate_device(); 97 if (!input) { 98 error = -ENOMEM; 99 goto err_free_button; 100 } 101 102 name = acpi_device_name(device); 103 class = acpi_device_class(device); 104 > 105 id = acpi_match_device(ebook_device_ids, device); 106 if (!id) { 107 dev_err(&device->dev, "Unsupported hid\n"); 108 error = -ENODEV; 109 goto err_free_input; 110 } 111 112 strcpy(name, XO15_EBOOK_DEVICE_NAME); 113 sprintf(class, "%s/%s", XO15_EBOOK_CLASS, XO15_EBOOK_SUBCLASS); 114 115 snprintf(button->phys, sizeof(button->phys), "%s/button/input0", id->id); 116 117 input->name = name; 118 input->phys = button->phys; 119 input->id.bustype = BUS_HOST; 120 input->dev.parent = &device->dev; 121 122 input->evbit[0] = BIT_MASK(EV_SW); 123 set_bit(SW_TABLET_MODE, input->swbit); 124 125 error = input_register_device(input); 126 if (error) 127 goto err_free_input; 128 129 ebook_send_state(device); 130 131 if (device->wakeup.flags.valid) { 132 /* Button's GPE is run-wake GPE */ 133 acpi_enable_gpe(device->wakeup.gpe_device, 134 device->wakeup.gpe_number); 135 device_set_wakeup_enable(&device->dev, true); 136 } 137 138 return 0; 139 140 err_free_input: 141 input_free_device(input); 142 err_free_button: 143 kfree(button); 144 return error; 145 } 146
On Fri, Oct 06, 2023 at 05:34:19PM +0200, Hans de Goede wrote: > On 10/6/23 17:31, Andy Shevchenko wrote: ... ` > Thanks, patch looks good to me: > Reviewed-by: Hans de Goede <hdegoede@redhat.com> Same issue as with other patch... ... > > + id = acpi_match_device(ebook_device_ids, device); Should be acpi_match_acpi_device(). > > + if (!id) { > > + dev_err(&device->dev, "Unsupported hid\n"); > > error = -ENODEV; > > goto err_free_input; > > }
diff --git a/drivers/platform/x86/xo15-ebook.c b/drivers/platform/x86/xo15-ebook.c index 391f7ea4431e..2ae8a58adcd0 100644 --- a/drivers/platform/x86/xo15-ebook.c +++ b/drivers/platform/x86/xo15-ebook.c @@ -81,9 +81,9 @@ static SIMPLE_DEV_PM_OPS(ebook_switch_pm, NULL, ebook_switch_resume); static int ebook_switch_add(struct acpi_device *device) { + const struct acpi_device_id *id; struct ebook_switch *button; struct input_dev *input; - const char *hid = acpi_device_hid(device); char *name, *class; int error; @@ -102,8 +102,9 @@ static int ebook_switch_add(struct acpi_device *device) name = acpi_device_name(device); class = acpi_device_class(device); - if (strcmp(hid, XO15_EBOOK_HID)) { - pr_err("Unsupported hid [%s]\n", hid); + id = acpi_match_device(ebook_device_ids, device); + if (!id) { + dev_err(&device->dev, "Unsupported hid\n"); error = -ENODEV; goto err_free_input; } @@ -111,7 +112,7 @@ static int ebook_switch_add(struct acpi_device *device) strcpy(name, XO15_EBOOK_DEVICE_NAME); sprintf(class, "%s/%s", XO15_EBOOK_CLASS, XO15_EBOOK_SUBCLASS); - snprintf(button->phys, sizeof(button->phys), "%s/button/input0", hid); + snprintf(button->phys, sizeof(button->phys), "%s/button/input0", id->id); input->name = name; input->phys = button->phys;