Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Andy Shevchenko and committed by
Greg Kroah-Hartman
c21b0837 82b070be

+2 -7
+2 -7
drivers/spi/spi.c
··· 2613 2613 } 2614 2614 EXPORT_SYMBOL_GPL(spi_slave_abort); 2615 2615 2616 - static int match_true(struct device *dev, void *data) 2617 - { 2618 - return 1; 2619 - } 2620 - 2621 2616 static ssize_t slave_show(struct device *dev, struct device_attribute *attr, 2622 2617 char *buf) 2623 2618 { ··· 2620 2625 dev); 2621 2626 struct device *child; 2622 2627 2623 - child = device_find_child(&ctlr->dev, NULL, match_true); 2628 + child = device_find_any_child(&ctlr->dev); 2624 2629 return sprintf(buf, "%s\n", 2625 2630 child ? to_spi_device(child)->modalias : NULL); 2626 2631 } ··· 2639 2644 if (rc != 1 || !name[0]) 2640 2645 return -EINVAL; 2641 2646 2642 - child = device_find_child(&ctlr->dev, NULL, match_true); 2647 + child = device_find_any_child(&ctlr->dev); 2643 2648 if (child) { 2644 2649 /* Remove registered slave */ 2645 2650 device_unregister(child);