* [PATCH v1 1/1] spi: Replace match_true() by device_match_any()
@ 2022-06-07 19:06 Andy Shevchenko
2022-06-07 19:49 ` Andy Shevchenko
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Andy Shevchenko @ 2022-06-07 19:06 UTC (permalink / raw)
To: Mark Brown, linux-spi, linux-kernel; +Cc: Andy Shevchenko
We have already a helper to match any device, use it and drop match_true().
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/spi/spi.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index ea09d1b42bf6..24440cd4aa5e 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -2613,11 +2613,6 @@ int spi_slave_abort(struct spi_device *spi)
}
EXPORT_SYMBOL_GPL(spi_slave_abort);
-static int match_true(struct device *dev, void *data)
-{
- return 1;
-}
-
static ssize_t slave_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
@@ -2625,7 +2620,7 @@ static ssize_t slave_show(struct device *dev, struct device_attribute *attr,
dev);
struct device *child;
- child = device_find_child(&ctlr->dev, NULL, match_true);
+ child = device_find_child(&ctlr->dev, NULL, device_match_any);
return sprintf(buf, "%s\n",
child ? to_spi_device(child)->modalias : NULL);
}
@@ -2644,7 +2639,7 @@ static ssize_t slave_store(struct device *dev, struct device_attribute *attr,
if (rc != 1 || !name[0])
return -EINVAL;
- child = device_find_child(&ctlr->dev, NULL, match_true);
+ child = device_find_child(&ctlr->dev, NULL, device_match_any);
if (child) {
/* Remove registered slave */
device_unregister(child);
--
2.35.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v1 1/1] spi: Replace match_true() by device_match_any()
2022-06-07 19:06 [PATCH v1 1/1] spi: Replace match_true() by device_match_any() Andy Shevchenko
@ 2022-06-07 19:49 ` Andy Shevchenko
2022-06-08 21:38 ` kernel test robot
2022-06-08 21:59 ` kernel test robot
2 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2022-06-07 19:49 UTC (permalink / raw)
To: Mark Brown, linux-spi, linux-kernel
On Tue, Jun 07, 2022 at 10:06:01PM +0300, Andy Shevchenko wrote:
> We have already a helper to match any device, use it and drop match_true().
Scratch this, it seems I compiled against wrong config and haven't noticed
types mismatch.
We can't use the proposed helper since it's only for for_each type of
functions.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1 1/1] spi: Replace match_true() by device_match_any()
2022-06-07 19:06 [PATCH v1 1/1] spi: Replace match_true() by device_match_any() Andy Shevchenko
2022-06-07 19:49 ` Andy Shevchenko
@ 2022-06-08 21:38 ` kernel test robot
2022-06-08 21:59 ` kernel test robot
2 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2022-06-08 21:38 UTC (permalink / raw)
To: Andy Shevchenko, Mark Brown, linux-spi, linux-kernel
Cc: llvm, kbuild-all, Andy Shevchenko
Hi Andy,
I love your patch! Yet something to improve:
[auto build test ERROR on broonie-spi/for-next]
[also build test ERROR on v5.19-rc1 next-20220608]
[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/spi-Replace-match_true-by-device_match_any/20220608-091910
base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
config: i386-randconfig-a002 (https://download.01.org/0day-ci/archive/20220609/202206090508.laygQP9P-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project b92436efcb7813fc481b30f2593a4907568d917a)
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/bbdbed23cc6f2f8e7c9d8da3bb6c78fe488747f1
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Andy-Shevchenko/spi-Replace-match_true-by-device_match_any/20220608-091910
git checkout bbdbed23cc6f2f8e7c9d8da3bb6c78fe488747f1
# 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=i386 SHELL=/bin/bash drivers/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
>> drivers/spi/spi.c:2670:46: error: incompatible function pointer types passing 'int (struct device *, const void *)' to parameter of type 'int (*)(struct device *, void *)' [-Werror,-Wincompatible-function-pointer-types]
child = device_find_child(&ctlr->dev, NULL, device_match_any);
^~~~~~~~~~~~~~~~
include/linux/device.h:905:12: note: passing argument to parameter 'match' here
int (*match)(struct device *dev, void *data));
^
drivers/spi/spi.c:2689:46: error: incompatible function pointer types passing 'int (struct device *, const void *)' to parameter of type 'int (*)(struct device *, void *)' [-Werror,-Wincompatible-function-pointer-types]
child = device_find_child(&ctlr->dev, NULL, device_match_any);
^~~~~~~~~~~~~~~~
include/linux/device.h:905:12: note: passing argument to parameter 'match' here
int (*match)(struct device *dev, void *data));
^
2 errors generated.
vim +2670 drivers/spi/spi.c
2662
2663 static ssize_t slave_show(struct device *dev, struct device_attribute *attr,
2664 char *buf)
2665 {
2666 struct spi_controller *ctlr = container_of(dev, struct spi_controller,
2667 dev);
2668 struct device *child;
2669
> 2670 child = device_find_child(&ctlr->dev, NULL, device_match_any);
2671 return sprintf(buf, "%s\n",
2672 child ? to_spi_device(child)->modalias : NULL);
2673 }
2674
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1 1/1] spi: Replace match_true() by device_match_any()
2022-06-07 19:06 [PATCH v1 1/1] spi: Replace match_true() by device_match_any() Andy Shevchenko
2022-06-07 19:49 ` Andy Shevchenko
2022-06-08 21:38 ` kernel test robot
@ 2022-06-08 21:59 ` kernel test robot
2 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2022-06-08 21:59 UTC (permalink / raw)
To: Andy Shevchenko, Mark Brown, linux-spi, linux-kernel
Cc: kbuild-all, Andy Shevchenko
Hi Andy,
I love your patch! Yet something to improve:
[auto build test ERROR on broonie-spi/for-next]
[also build test ERROR on v5.19-rc1 next-20220608]
[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/spi-Replace-match_true-by-device_match_any/20220608-091910
base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
config: x86_64-randconfig-a013 (https://download.01.org/0day-ci/archive/20220609/202206090531.0eWVAe0k-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/bbdbed23cc6f2f8e7c9d8da3bb6c78fe488747f1
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Andy-Shevchenko/spi-Replace-match_true-by-device_match_any/20220608-091910
git checkout bbdbed23cc6f2f8e7c9d8da3bb6c78fe488747f1
# 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
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
drivers/spi/spi.c: In function 'slave_show':
>> drivers/spi/spi.c:2670:53: error: passing argument 3 of 'device_find_child' from incompatible pointer type [-Werror=incompatible-pointer-types]
2670 | child = device_find_child(&ctlr->dev, NULL, device_match_any);
| ^~~~~~~~~~~~~~~~
| |
| int (*)(struct device *, const void *)
In file included from drivers/spi/spi.c:8:
include/linux/device.h:905:40: note: expected 'int (*)(struct device *, void *)' but argument is of type 'int (*)(struct device *, const void *)'
905 | int (*match)(struct device *dev, void *data));
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/spi/spi.c: In function 'slave_store':
drivers/spi/spi.c:2689:53: error: passing argument 3 of 'device_find_child' from incompatible pointer type [-Werror=incompatible-pointer-types]
2689 | child = device_find_child(&ctlr->dev, NULL, device_match_any);
| ^~~~~~~~~~~~~~~~
| |
| int (*)(struct device *, const void *)
In file included from drivers/spi/spi.c:8:
include/linux/device.h:905:40: note: expected 'int (*)(struct device *, void *)' but argument is of type 'int (*)(struct device *, const void *)'
905 | int (*match)(struct device *dev, void *data));
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +/device_find_child +2670 drivers/spi/spi.c
2662
2663 static ssize_t slave_show(struct device *dev, struct device_attribute *attr,
2664 char *buf)
2665 {
2666 struct spi_controller *ctlr = container_of(dev, struct spi_controller,
2667 dev);
2668 struct device *child;
2669
> 2670 child = device_find_child(&ctlr->dev, NULL, device_match_any);
2671 return sprintf(buf, "%s\n",
2672 child ? to_spi_device(child)->modalias : NULL);
2673 }
2674
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-06-08 21:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-07 19:06 [PATCH v1 1/1] spi: Replace match_true() by device_match_any() Andy Shevchenko
2022-06-07 19:49 ` Andy Shevchenko
2022-06-08 21:38 ` kernel test robot
2022-06-08 21:59 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).