History

Merge branch 'generic_lookup_helpers' into driver-core-next

This was on a separate branch so that others can pull it in.

Greg Kroah-Hartman committed 7 years ago

Commit f87da582 parents fb583c8 36f331348 files · +341 −383Browse files

Showing the changes to include/linux (2 of 48 files). Show all

Unified · Split

2 files
  1. include/linux/device.h +234 −3
  2. include/linux/platform_device.h +3 −0
include/linux/device.h+234−3
@@ -164,16 +164,100 @@ void subsys_dev_iter_init(struct subsys_dev_iter *iter, · 163 unmodified lines
164struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter);164struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter);
165void subsys_dev_iter_exit(struct subsys_dev_iter *iter);165void subsys_dev_iter_exit(struct subsys_dev_iter *iter);
166 166
167int device_match_name(struct device *dev, const void *name);
167int device_match_of_node(struct device *dev, const void *np);168int device_match_of_node(struct device *dev, const void *np);
169int device_match_fwnode(struct device *dev, const void *fwnode);
170int device_match_devt(struct device *dev, const void *pdevt);
171int device_match_acpi_dev(struct device *dev, const void *adev);
172int device_match_any(struct device *dev, const void *unused);
168 173
169int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data,174int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data,
170 int (*fn)(struct device *dev, void *data));175 int (*fn)(struct device *dev, void *data));
171struct device *bus_find_device(struct bus_type *bus, struct device *start,176struct device *bus_find_device(struct bus_type *bus, struct device *start,
172 const void *data,177 const void *data,
173 int (*match)(struct device *dev, const void *data));178 int (*match)(struct device *dev, const void *data));
174struct device *bus_find_device_by_name(struct bus_type *bus,179/**
175 struct device *start,180 * bus_find_device_by_name - device iterator for locating a particular device
176 const char *name);181 * of a specific name.
182 * @bus: bus type
183 * @start: Device to begin with
184 * @name: name of the device to match
185 */
186static inline struct device *bus_find_device_by_name(struct bus_type *bus,
187 struct device *start,
188 const char *name)
189{
190 return bus_find_device(bus, start, name, device_match_name);
191}
192
193/**
194 * bus_find_device_by_of_node : device iterator for locating a particular device
195 * matching the of_node.
196 * @bus: bus type
197 * @np: of_node of the device to match.
198 */
199static inline struct device *
200bus_find_device_by_of_node(struct bus_type *bus, const struct device_node *np)
201{
202 return bus_find_device(bus, NULL, np, device_match_of_node);
203}
204
205/**
206 * bus_find_device_by_fwnode : device iterator for locating a particular device
207 * matching the fwnode.
208 * @bus: bus type
209 * @fwnode: fwnode of the device to match.
210 */
211static inline struct device *
212bus_find_device_by_fwnode(struct bus_type *bus, const struct fwnode_handle *fwnode)
213{
214 return bus_find_device(bus, NULL, fwnode, device_match_fwnode);
215}
216
217/**
218 * bus_find_device_by_devt : device iterator for locating a particular device
219 * matching the device type.
220 * @bus: bus type
221 * @devt: device type of the device to match.
222 */
223static inline struct device *bus_find_device_by_devt(struct bus_type *bus,
224 dev_t devt)
225{
226 return bus_find_device(bus, NULL, &devt, device_match_devt);
227}
228
229/**
230 * bus_find_next_device - Find the next device after a given device in a
231 * given bus.
232 */
233static inline struct device *
234bus_find_next_device(struct bus_type *bus,struct device *cur)
235{
236 return bus_find_device(bus, cur, NULL, device_match_any);
237}
238
239#ifdef CONFIG_ACPI
240struct acpi_device;
241
242/**
243 * bus_find_device_by_acpi_dev : device iterator for locating a particular device
244 * matching the ACPI COMPANION device.
245 * @bus: bus type
246 * @adev: ACPI COMPANION device to match.
247 */
248static inline struct device *
249bus_find_device_by_acpi_dev(struct bus_type *bus, const struct acpi_device *adev)
250{
251 return bus_find_device(bus, NULL, adev, device_match_acpi_dev);
252}
253#else
254static inline struct device *
255bus_find_device_by_acpi_dev(struct bus_type *bus, const void *adev)
256{
257 return NULL;
258}
259#endif
260
177struct device *subsys_find_device_by_id(struct bus_type *bus, unsigned int id,261struct device *subsys_find_device_by_id(struct bus_type *bus, unsigned int id,
178 struct device *hint);262 struct device *hint);
179int bus_for_each_drv(struct bus_type *bus, struct device_driver *start,263int bus_for_each_drv(struct bus_type *bus, struct device_driver *start,
@@ -342,6 +426,83 @@ struct device *driver_find_device(struct device_driver *drv, · 162 unmodified lines
342 struct device *start, const void *data,426 struct device *start, const void *data,
343 int (*match)(struct device *dev, const void *data));427 int (*match)(struct device *dev, const void *data));
344 428
429/**
430 * driver_find_device_by_name - device iterator for locating a particular device
431 * of a specific name.
432 * @driver: the driver we're iterating
433 * @name: name of the device to match
434 */
435static inline struct device *driver_find_device_by_name(struct device_driver *drv,
436 const char *name)
437{
438 return driver_find_device(drv, NULL, name, device_match_name);
439}
440
441/**
442 * driver_find_device_by_of_node- device iterator for locating a particular device
443 * by of_node pointer.
444 * @driver: the driver we're iterating
445 * @np: of_node pointer to match.
446 */
447static inline struct device *
448driver_find_device_by_of_node(struct device_driver *drv,
449 const struct device_node *np)
450{
451 return driver_find_device(drv, NULL, np, device_match_of_node);
452}
453
454/**
455 * driver_find_device_by_fwnode- device iterator for locating a particular device
456 * by fwnode pointer.
457 * @driver: the driver we're iterating
458 * @fwnode: fwnode pointer to match.
459 */
460static inline struct device *
461driver_find_device_by_fwnode(struct device_driver *drv,
462 const struct fwnode_handle *fwnode)
463{
464 return driver_find_device(drv, NULL, fwnode, device_match_fwnode);
465}
466
467/**
468 * driver_find_device_by_devt- device iterator for locating a particular device
469 * by devt.
470 * @driver: the driver we're iterating
471 * @devt: devt pointer to match.
472 */
473static inline struct device *driver_find_device_by_devt(struct device_driver *drv,
474 dev_t devt)
475{
476 return driver_find_device(drv, NULL, &devt, device_match_devt);
477}
478
479static inline struct device *driver_find_next_device(struct device_driver *drv,
480 struct device *start)
481{
482 return driver_find_device(drv, start, NULL, device_match_any);
483}
484
485#ifdef CONFIG_ACPI
486/**
487 * driver_find_device_by_acpi_dev : device iterator for locating a particular
488 * device matching the ACPI_COMPANION device.
489 * @driver: the driver we're iterating
490 * @adev: ACPI_COMPANION device to match.
491 */
492static inline struct device *
493driver_find_device_by_acpi_dev(struct device_driver *drv,
494 const struct acpi_device *adev)
495{
496 return driver_find_device(drv, NULL, adev, device_match_acpi_dev);
497}
498#else
499static inline struct device *
500driver_find_device_by_acpi_dev(struct device_driver *drv, const void *adev)
501{
502 return NULL;
503}
504#endif
505
345void driver_deferred_probe_add(struct device *dev);506void driver_deferred_probe_add(struct device *dev);
346int driver_deferred_probe_check_state(struct device *dev);507int driver_deferred_probe_check_state(struct device *dev);
347int driver_deferred_probe_check_state_continue(struct device *dev);508int driver_deferred_probe_check_state_continue(struct device *dev);
@@ -471,6 +632,76 @@ extern struct device *class_find_device(struct class *class, · 123 unmodified lines
471 struct device *start, const void *data,632 struct device *start, const void *data,
472 int (*match)(struct device *, const void *));633 int (*match)(struct device *, const void *));
473 634
635/**
636 * class_find_device_by_name - device iterator for locating a particular device
637 * of a specific name.
638 * @class: class type
639 * @name: name of the device to match
640 */
641static inline struct device *class_find_device_by_name(struct class *class,
642 const char *name)
643{
644 return class_find_device(class, NULL, name, device_match_name);
645}
646
647/**
648 * class_find_device_by_of_node : device iterator for locating a particular device
649 * matching the of_node.
650 * @class: class type
651 * @np: of_node of the device to match.
652 */
653static inline struct device *
654class_find_device_by_of_node(struct class *class, const struct device_node *np)
655{
656 return class_find_device(class, NULL, np, device_match_of_node);
657}
658
659/**
660 * class_find_device_by_fwnode : device iterator for locating a particular device
661 * matching the fwnode.
662 * @class: class type
663 * @fwnode: fwnode of the device to match.
664 */
665static inline struct device *
666class_find_device_by_fwnode(struct class *class,
667 const struct fwnode_handle *fwnode)
668{
669 return class_find_device(class, NULL, fwnode, device_match_fwnode);
670}
671
672/**
673 * class_find_device_by_devt : device iterator for locating a particular device
674 * matching the device type.
675 * @class: class type
676 * @devt: device type of the device to match.
677 */
678static inline struct device *class_find_device_by_devt(struct class *class,
679 dev_t devt)
680{
681 return class_find_device(class, NULL, &devt, device_match_devt);
682}
683
684#ifdef CONFIG_ACPI
685struct acpi_device;
686/**
687 * class_find_device_by_acpi_dev : device iterator for locating a particular
688 * device matching the ACPI_COMPANION device.
689 * @class: class type
690 * @adev: ACPI_COMPANION device to match.
691 */
692static inline struct device *
693class_find_device_by_acpi_dev(struct class *class, const struct acpi_device *adev)
694{
695 return class_find_device(class, NULL, adev, device_match_acpi_dev);
696}
697#else
698static inline struct device *
699class_find_device_by_acpi_dev(struct class *class, const void *adev)
700{
701 return NULL;
702}
703#endif
704
474struct class_attribute {705struct class_attribute {
475 struct attribute attr;706 struct attribute attr;
476 ssize_t (*show)(struct class *class, struct class_attribute *attr,707 ssize_t (*show)(struct class *class, struct class_attribute *attr,
include/linux/platform_device.h+3−0
@@ -51,6 +51,9 @@ extern struct device platform_bus; · 50 unmodified lines
51extern void arch_setup_pdev_archdata(struct platform_device *);51extern void arch_setup_pdev_archdata(struct platform_device *);
52extern struct resource *platform_get_resource(struct platform_device *,52extern struct resource *platform_get_resource(struct platform_device *,
53 unsigned int, unsigned int);53 unsigned int, unsigned int);
54extern struct device *
55platform_find_device_by_driver(struct device *start,
56 const struct device_driver *drv);
54extern void __iomem *57extern void __iomem *
55devm_platform_ioremap_resource(struct platform_device *pdev,58devm_platform_ioremap_resource(struct platform_device *pdev,
56 unsigned int index);59 unsigned int index);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t