All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/1] i2c: scmi: Replace open coded device_get_match_data()
@ 2022-07-08 10:02 Andy Shevchenko
  2022-07-08 11:50 ` kernel test robot
  2022-07-08 12:01 ` kernel test robot
  0 siblings, 2 replies; 4+ messages in thread
From: Andy Shevchenko @ 2022-07-08 10:02 UTC (permalink / raw)
  To: Andy Shevchenko, linux-i2c, linux-kernel; +Cc: Wolfram Sang

Replace open coded device_get_match_data() in acpi_smbus_cmi_add().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: used device_get_match_data() instead
 drivers/i2c/busses/i2c-scmi.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/i2c/busses/i2c-scmi.c b/drivers/i2c/busses/i2c-scmi.c
index 6746aa46d96c..ab318ff78a82 100644
--- a/drivers/i2c/busses/i2c-scmi.c
+++ b/drivers/i2c/busses/i2c-scmi.c
@@ -369,6 +369,7 @@ static int acpi_smbus_cmi_add(struct acpi_device *device)
 		return -ENOMEM;
 
 	smbus_cmi->handle = device->handle;
+	smbus_cmi->methods = device_get_match_data(&device->dev);
 	strcpy(acpi_device_name(device), ACPI_SMBUS_HC_DEVICE_NAME);
 	strcpy(acpi_device_class(device), ACPI_SMBUS_HC_CLASS);
 	device->driver_data = smbus_cmi;
@@ -376,11 +377,6 @@ static int acpi_smbus_cmi_add(struct acpi_device *device)
 	smbus_cmi->cap_read = 0;
 	smbus_cmi->cap_write = 0;
 
-	for (id = acpi_smbus_cmi_ids; id->id[0]; id++)
-		if (!strcmp(id->id, acpi_device_hid(device)))
-			smbus_cmi->methods =
-				(struct smbus_methods_t *) id->driver_data;
-
 	acpi_walk_namespace(ACPI_TYPE_METHOD, smbus_cmi->handle, 1,
 			    acpi_smbus_cmi_query_methods, NULL, smbus_cmi, NULL);
 
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/1] i2c: scmi: Replace open coded device_get_match_data()
  2022-07-08 10:02 [PATCH v2 1/1] i2c: scmi: Replace open coded device_get_match_data() Andy Shevchenko
@ 2022-07-08 11:50 ` kernel test robot
  2022-07-08 12:03   ` Andy Shevchenko
  2022-07-08 12:01 ` kernel test robot
  1 sibling, 1 reply; 4+ messages in thread
From: kernel test robot @ 2022-07-08 11:50 UTC (permalink / raw)
  To: Andy Shevchenko, linux-i2c, linux-kernel; +Cc: kbuild-all, Wolfram Sang

Hi Andy,

I love your patch! Perhaps something to improve:

[auto build test WARNING on wsa/i2c/for-next]
[also build test WARNING on linus/master v5.19-rc5 next-20220708]
[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/i2c-scmi-Replace-open-coded-device_get_match_data/20220708-180449
base:   https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/for-next
config: i386-randconfig-a001 (https://download.01.org/0day-ci/archive/20220708/202207081957.tSlBfZYh-lkp@intel.com/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/c111b5704bd215394f238fa88925d6832cf2562c
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Andy-Shevchenko/i2c-scmi-Replace-open-coded-device_get_match_data/20220708-180449
        git checkout c111b5704bd215394f238fa88925d6832cf2562c
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/i2c/busses/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   drivers/i2c/busses/i2c-scmi.c: In function 'acpi_smbus_cmi_add':
>> drivers/i2c/busses/i2c-scmi.c:372:28: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     372 |         smbus_cmi->methods = device_get_match_data(&device->dev);
         |                            ^
>> drivers/i2c/busses/i2c-scmi.c:364:38: warning: unused variable 'id' [-Wunused-variable]
     364 |         const struct acpi_device_id *id;
         |                                      ^~


vim +/const +372 drivers/i2c/busses/i2c-scmi.c

   360	
   361	static int acpi_smbus_cmi_add(struct acpi_device *device)
   362	{
   363		struct acpi_smbus_cmi *smbus_cmi;
 > 364		const struct acpi_device_id *id;
   365		int ret;
   366	
   367		smbus_cmi = kzalloc(sizeof(struct acpi_smbus_cmi), GFP_KERNEL);
   368		if (!smbus_cmi)
   369			return -ENOMEM;
   370	
   371		smbus_cmi->handle = device->handle;
 > 372		smbus_cmi->methods = device_get_match_data(&device->dev);
   373		strcpy(acpi_device_name(device), ACPI_SMBUS_HC_DEVICE_NAME);
   374		strcpy(acpi_device_class(device), ACPI_SMBUS_HC_CLASS);
   375		device->driver_data = smbus_cmi;
   376		smbus_cmi->cap_info = 0;
   377		smbus_cmi->cap_read = 0;
   378		smbus_cmi->cap_write = 0;
   379	
   380		acpi_walk_namespace(ACPI_TYPE_METHOD, smbus_cmi->handle, 1,
   381				    acpi_smbus_cmi_query_methods, NULL, smbus_cmi, NULL);
   382	
   383		if (smbus_cmi->cap_info == 0) {
   384			ret = -ENODEV;
   385			goto err;
   386		}
   387	
   388		snprintf(smbus_cmi->adapter.name, sizeof(smbus_cmi->adapter.name),
   389			"SMBus CMI adapter %s",
   390			acpi_device_name(device));
   391		smbus_cmi->adapter.owner = THIS_MODULE;
   392		smbus_cmi->adapter.algo = &acpi_smbus_cmi_algorithm;
   393		smbus_cmi->adapter.algo_data = smbus_cmi;
   394		smbus_cmi->adapter.class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
   395		smbus_cmi->adapter.dev.parent = &device->dev;
   396	
   397		ret = i2c_add_adapter(&smbus_cmi->adapter);
   398		if (ret) {
   399			dev_err(&device->dev, "Couldn't register adapter!\n");
   400			goto err;
   401		}
   402	
   403		return 0;
   404	
   405	err:
   406		kfree(smbus_cmi);
   407		device->driver_data = NULL;
   408		return ret;
   409	}
   410	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/1] i2c: scmi: Replace open coded device_get_match_data()
  2022-07-08 10:02 [PATCH v2 1/1] i2c: scmi: Replace open coded device_get_match_data() Andy Shevchenko
  2022-07-08 11:50 ` kernel test robot
@ 2022-07-08 12:01 ` kernel test robot
  1 sibling, 0 replies; 4+ messages in thread
From: kernel test robot @ 2022-07-08 12:01 UTC (permalink / raw)
  To: Andy Shevchenko, linux-i2c, linux-kernel; +Cc: kbuild-all, Wolfram Sang

Hi Andy,

I love your patch! Perhaps something to improve:

[auto build test WARNING on wsa/i2c/for-next]
[also build test WARNING on linus/master v5.19-rc5 next-20220708]
[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/i2c-scmi-Replace-open-coded-device_get_match_data/20220708-180449
base:   https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/for-next
config: x86_64-rhel-8.3-func (https://download.01.org/0day-ci/archive/20220708/202207081929.oBd7Xtwy-lkp@intel.com/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/c111b5704bd215394f238fa88925d6832cf2562c
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Andy-Shevchenko/i2c-scmi-Replace-open-coded-device_get_match_data/20220708-180449
        git checkout c111b5704bd215394f238fa88925d6832cf2562c
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/i2c/busses/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   drivers/i2c/busses/i2c-scmi.c: In function 'acpi_smbus_cmi_add':
>> drivers/i2c/busses/i2c-scmi.c:372:28: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     372 |         smbus_cmi->methods = device_get_match_data(&device->dev);
         |                            ^
>> drivers/i2c/busses/i2c-scmi.c:364:38: warning: unused variable 'id' [-Wunused-variable]
     364 |         const struct acpi_device_id *id;
         |                                      ^~


vim +/const +372 drivers/i2c/busses/i2c-scmi.c

   360	
   361	static int acpi_smbus_cmi_add(struct acpi_device *device)
   362	{
   363		struct acpi_smbus_cmi *smbus_cmi;
 > 364		const struct acpi_device_id *id;
   365		int ret;
   366	
   367		smbus_cmi = kzalloc(sizeof(struct acpi_smbus_cmi), GFP_KERNEL);
   368		if (!smbus_cmi)
   369			return -ENOMEM;
   370	
   371		smbus_cmi->handle = device->handle;
 > 372		smbus_cmi->methods = device_get_match_data(&device->dev);
   373		strcpy(acpi_device_name(device), ACPI_SMBUS_HC_DEVICE_NAME);
   374		strcpy(acpi_device_class(device), ACPI_SMBUS_HC_CLASS);
   375		device->driver_data = smbus_cmi;
   376		smbus_cmi->cap_info = 0;
   377		smbus_cmi->cap_read = 0;
   378		smbus_cmi->cap_write = 0;
   379	
   380		acpi_walk_namespace(ACPI_TYPE_METHOD, smbus_cmi->handle, 1,
   381				    acpi_smbus_cmi_query_methods, NULL, smbus_cmi, NULL);
   382	
   383		if (smbus_cmi->cap_info == 0) {
   384			ret = -ENODEV;
   385			goto err;
   386		}
   387	
   388		snprintf(smbus_cmi->adapter.name, sizeof(smbus_cmi->adapter.name),
   389			"SMBus CMI adapter %s",
   390			acpi_device_name(device));
   391		smbus_cmi->adapter.owner = THIS_MODULE;
   392		smbus_cmi->adapter.algo = &acpi_smbus_cmi_algorithm;
   393		smbus_cmi->adapter.algo_data = smbus_cmi;
   394		smbus_cmi->adapter.class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
   395		smbus_cmi->adapter.dev.parent = &device->dev;
   396	
   397		ret = i2c_add_adapter(&smbus_cmi->adapter);
   398		if (ret) {
   399			dev_err(&device->dev, "Couldn't register adapter!\n");
   400			goto err;
   401		}
   402	
   403		return 0;
   404	
   405	err:
   406		kfree(smbus_cmi);
   407		device->driver_data = NULL;
   408		return ret;
   409	}
   410	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/1] i2c: scmi: Replace open coded device_get_match_data()
  2022-07-08 11:50 ` kernel test robot
@ 2022-07-08 12:03   ` Andy Shevchenko
  0 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2022-07-08 12:03 UTC (permalink / raw)
  To: kernel test robot; +Cc: linux-i2c, linux-kernel, kbuild-all, Wolfram Sang

On Fri, Jul 08, 2022 at 07:50:47PM +0800, kernel test robot wrote:
> Hi Andy,
> 
> I love your patch! Perhaps something to improve:

> All warnings (new ones prefixed by >>):

Sorry with that. New sparse is too noisy to see usefull output through.
I'll fix in v3.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-07-08 12:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-08 10:02 [PATCH v2 1/1] i2c: scmi: Replace open coded device_get_match_data() Andy Shevchenko
2022-07-08 11:50 ` kernel test robot
2022-07-08 12:03   ` Andy Shevchenko
2022-07-08 12:01 ` kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.