summaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi.c
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2022-06-10 15:02:19 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-06-10 16:01:55 +0200
commitc21b0837983d3b00c4f73927dae8441bf478087f (patch)
tree40a2a7ecb942e52c06068d46dbee1c266a3cf1df /drivers/spi/spi.c
parent82b070beae1ef55b0049768c8dc91d87565bb191 (diff)
downloadlinux-stable-c21b0837983d3b00c4f73927dae8441bf478087f.tar.gz
linux-stable-c21b0837983d3b00c4f73927dae8441bf478087f.tar.bz2
linux-stable-c21b0837983d3b00c4f73927dae8441bf478087f.zip
spi: Use device_find_any_child() instead of custom approach
We have already a helper to get the first child device, use it and drop custom approach. Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Mark Brown <broonie@kernel.org> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20220610120219.18988-2-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/spi/spi.c')
-rw-r--r--drivers/spi/spi.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index ea09d1b42bf6..b04be04dddfa 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_any_child(&ctlr->dev);
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_any_child(&ctlr->dev);
if (child) {
/* Remove registered slave */
device_unregister(child);