mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-21 06:50:25 +00:00
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>
This commit is contained in:
parent
82b070beae
commit
c21b083798
1 changed files with 2 additions and 7 deletions
|
@ -2613,11 +2613,6 @@ int spi_slave_abort(struct spi_device *spi)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(spi_slave_abort);
|
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,
|
static ssize_t slave_show(struct device *dev, struct device_attribute *attr,
|
||||||
char *buf)
|
char *buf)
|
||||||
{
|
{
|
||||||
|
@ -2625,7 +2620,7 @@ static ssize_t slave_show(struct device *dev, struct device_attribute *attr,
|
||||||
dev);
|
dev);
|
||||||
struct device *child;
|
struct device *child;
|
||||||
|
|
||||||
child = device_find_child(&ctlr->dev, NULL, match_true);
|
child = device_find_any_child(&ctlr->dev);
|
||||||
return sprintf(buf, "%s\n",
|
return sprintf(buf, "%s\n",
|
||||||
child ? to_spi_device(child)->modalias : NULL);
|
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])
|
if (rc != 1 || !name[0])
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
child = device_find_child(&ctlr->dev, NULL, match_true);
|
child = device_find_any_child(&ctlr->dev);
|
||||||
if (child) {
|
if (child) {
|
||||||
/* Remove registered slave */
|
/* Remove registered slave */
|
||||||
device_unregister(child);
|
device_unregister(child);
|
||||||
|
|
Loading…
Add table
Reference in a new issue