platform/x86: asus-wireless: Replace open coded acpi_match_device()
Subsystems (3)
PATCH 1/1 platform/x86: asus-wireless: Replace open coded acpi_match_device()
Replace open coded acpi_match_device() in asus_wireless_add().
--- drivers/platform/x86/asus-wireless.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/platform/x86/asus-wireless.c +3 -7
@@ -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 (adev, device_ids); +if (id) + data->hswc_params = (const struct hswc_params *)id->driver_data;if (!data->hswc_params)return 0 ;
Signature · 1 line
2.35.1
kernel test robot
build botI love your patch! Yet something to improve:
Hi Andy,
I love your patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on v5.19-rc4 next-20220630]
[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]
url: https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/platform-x86-asus-wireless-Replace-open-coded-acpi_match_device/20220701-033501 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 1a0e93df1e107dc766fdf86ae88076efd9f376e6 config: x86_64-randconfig-a003 (https://download.01.org/0day-ci/archive/20220701/[email protected]/config) compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project a774ba7f60d1fef403b5507b1b1a7475d3684d71)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/6aca63018deba5520de593749517efd03f7289c7
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Andy-Shevchenko/platform-x86-asus-wireless-Replace-open-coded-acpi_match_device/20220701-033501 git checkout 6aca63018deba5520de593749517efd03f7289c7
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/platform/x86/
If you fix the issue, kindly add following tag where applicable
All errors (new ones prefixed by >>):
>> drivers/platform/x86/asus-wireless.c:151:25: error: incompatible pointer types passing 'struct acpi_device *' to parameter of type 'const struct acpi_device_id *' [-Werror,-Wincompatible-pointer-types]
id = acpi_match_device(adev, device_ids);
^~~~
include/linux/acpi.h:713:77: note: passing argument to parameter 'ids' here
const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids,
^
>> drivers/platform/x86/asus-wireless.c:151:31: error: incompatible pointer types passing 'const struct acpi_device_id[3]' to parameter of type 'const struct device *' [-Werror,-Wincompatible-pointer-types]
id = acpi_match_device(adev, device_ids);
^~~~~~~~~~
include/linux/acpi.h:714:34: note: passing argument to parameter 'dev' here
const struct device *dev);
^2 errors generated.
vim +151 drivers/platform/x86/asus-wireless.c
125
126 static int asus_wireless_add(struct acpi_device *adev)
127 {
128 struct asus_wireless_data *data;
129 const struct acpi_device_id *id;
130 int err;
131
132 data = devm_kzalloc(&adev->dev, sizeof(*data), GFP_KERNEL);
133 if (!data)
134 return -ENOMEM;
135 adev->driver_data = data;
136 data->adev = adev;
137
138 data->idev = devm_input_allocate_device(&adev->dev);
139 if (!data->idev)
140 return -ENOMEM;
141 data->idev->name = "Asus Wireless Radio Control";
142 data->idev->phys = "asus-wireless/input0";
143 data->idev->id.bustype = BUS_HOST;
144 data->idev->id.vendor = PCI_VENDOR_ID_ASUSTEK;
145 set_bit(EV_KEY, data->idev->evbit);
146 set_bit(KEY_RFKILL, data->idev->keybit);
147 err = input_register_device(data->idev);
148 if (err)
149 return err;
150
> 151 id = acpi_match_device(adev, device_ids);
152 if (id)
153 data->hswc_params = (const struct hswc_params *)id->driver_data;
154 if (!data->hswc_params)
155 return 0;
156
157 data->wq = create_singlethread_workqueue("asus_wireless_workqueue");
158 if (!data->wq)
159 return -ENOMEM;
160 INIT_WORK(&data->led_work, led_state_update);
161 data->led.name = "asus-wireless::airplane";
162 data->led.brightness_set = led_state_set;
163 data->led.brightness_get = led_state_get;
164 data->led.flags = LED_CORE_SUSPENDRESUME;
165 data->led.max_brightness = 1;
166 data->led.default_trigger = "rfkill-none";
167 err = devm_led_classdev_register(&adev->dev, &data->led);
168 if (err)
169 destroy_workqueue(data->wq);
170
171 return err;
172 }
173
Signature · 2 lines
0-DAY CI Kernel Test Service https://01.org/lkp
kernel test robot
build botI love your patch! Yet something to improve:
Hi Andy,
I love your patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on platform-drivers-x86/for-next v5.19-rc4 next-20220630] [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]
url: https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/platform-x86-asus-wireless-Replace-open-coded-acpi_match_device/20220701-033501 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 1a0e93df1e107dc766fdf86ae88076efd9f376e6 config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20220701/[email protected]/config) compiler: gcc-11 (Debian 11.3.0-3) 11.3.0 reproduce (this is a W=1 build): # https://github.com/intel-lab-lkp/linux/commit/6aca63018deba5520de593749517efd03f7289c7 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Andy-Shevchenko/platform-x86-asus-wireless-Replace-open-coded-acpi_match_device/20220701-033501 git checkout 6aca63018deba5520de593749517efd03f7289c7 # save the config file mkdir build_dir && cp config build_dir/.config make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
All errors (new ones prefixed by >>):
drivers/platform/x86/asus-wireless.c: In function 'asus_wireless_add':
>> drivers/platform/x86/asus-wireless.c:151:32: error: passing argument 1 of 'acpi_match_device' from incompatible pointer type [-Werror=incompatible-pointer-types]
151 | id = acpi_match_device(adev, device_ids);
| ^~~~
| |
| struct acpi_device *
In file included from drivers/platform/x86/asus-wireless.c:12:
include/linux/acpi.h:713:77: note: expected 'const struct acpi_device_id *' but argument is of type 'struct acpi_device *'
713 | const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
drivers/platform/x86/asus-wireless.c:151:38: error: passing argument 2 of 'acpi_match_device' from incompatible pointer type [-Werror=incompatible-pointer-types]
151 | id = acpi_match_device(adev, device_ids);
| ^~~~~~~~~~
| |
| const struct acpi_device_id *
In file included from drivers/platform/x86/asus-wireless.c:12:
include/linux/acpi.h:714:69: note: expected 'const struct device *' but argument is of type 'const struct acpi_device_id *'
714 | const struct device *dev);
| ~~~~~~~~~~~~~~~~~~~~~^~~cc1: some warnings being treated as errors
vim +/acpi_match_device +151 drivers/platform/x86/asus-wireless.c
125
126 static int asus_wireless_add(struct acpi_device *adev)
127 {
128 struct asus_wireless_data *data;
129 const struct acpi_device_id *id;
130 int err;
131
132 data = devm_kzalloc(&adev->dev, sizeof(*data), GFP_KERNEL);
133 if (!data)
134 return -ENOMEM;
135 adev->driver_data = data;
136 data->adev = adev;
137
138 data->idev = devm_input_allocate_device(&adev->dev);
139 if (!data->idev)
140 return -ENOMEM;
141 data->idev->name = "Asus Wireless Radio Control";
142 data->idev->phys = "asus-wireless/input0";
143 data->idev->id.bustype = BUS_HOST;
144 data->idev->id.vendor = PCI_VENDOR_ID_ASUSTEK;
145 set_bit(EV_KEY, data->idev->evbit);
146 set_bit(KEY_RFKILL, data->idev->keybit);
147 err = input_register_device(data->idev);
148 if (err)
149 return err;
150
> 151 id = acpi_match_device(adev, device_ids);
152 if (id)
153 data->hswc_params = (const struct hswc_params *)id->driver_data;
154 if (!data->hswc_params)
155 return 0;
156
157 data->wq = create_singlethread_workqueue("asus_wireless_workqueue");
158 if (!data->wq)
159 return -ENOMEM;
160 INIT_WORK(&data->led_work, led_state_update);
161 data->led.name = "asus-wireless::airplane";
162 data->led.brightness_set = led_state_set;
163 data->led.brightness_get = led_state_get;
164 data->led.flags = LED_CORE_SUSPENDRESUME;
165 data->led.max_brightness = 1;
166 data->led.default_trigger = "rfkill-none";
167 err = devm_led_classdev_register(&adev->dev, &data->led);
168 if (err)
169 destroy_workqueue(data->wq);
170
171 return err;
172 }
173
Signature · 2 lines
0-DAY CI Kernel Test Service https://01.org/lkp
Quoted 1 line · Andy Shevchenko
Replace open coded
acpi_match_device()inasus_wireless_add().
Discard this, a last minute change that makes it not buildable.
Signature · 2 lines
With Best Regards, Andy Shevchenko