spi: Use device_find_any_child() instead of custom approach
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2071848 Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2122415 commit c21b0837983d3b00c4f73927dae8441bf478087f Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Date: Fri, 10 Jun 2022 15:02:19 +0300 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> Signed-off-by: Mark Salter <msalter@redhat.com>
This commit is contained in:
parent
f95b99780b
commit
5261ee620e
|
@ -2696,11 +2696,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)
|
||||
{
|
||||
|
@ -2708,7 +2703,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);
|
||||
}
|
||||
|
@ -2727,7 +2722,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);
|
||||
|
|
Loading…
Reference in New Issue