Lines Matching refs:dev
68 int (*add_dev)(struct device *dev, struct subsys_interface *sif);
69 void (*remove_dev)(struct device *dev, struct subsys_interface *sif);
92 int (*uevent)(const struct device *dev, struct kobj_uevent_env *env);
93 char *(*devnode)(const struct device *dev, umode_t *mode,
95 void (*release)(struct device *dev);
108 ssize_t (*show)(struct device *dev, struct device_attribute *attr,
110 ssize_t (*store)(struct device *dev, struct device_attribute *attr,
124 ssize_t device_show_ulong(struct device *dev, struct device_attribute *attr,
126 ssize_t device_store_ulong(struct device *dev, struct device_attribute *attr,
128 ssize_t device_show_int(struct device *dev, struct device_attribute *attr,
130 ssize_t device_store_int(struct device *dev, struct device_attribute *attr,
132 ssize_t device_show_bool(struct device *dev, struct device_attribute *attr,
134 ssize_t device_store_bool(struct device *dev, struct device_attribute *attr,
136 ssize_t device_show_string(struct device *dev, struct device_attribute *attr,
276 void device_remove_file(struct device *dev,
278 bool device_remove_file_self(struct device *dev,
280 int __must_check device_create_bin_file(struct device *dev,
282 void device_remove_bin_file(struct device *dev,
286 void devm_remove_action(struct device *dev, void (*action)(void *), void *data);
287 void devm_release_action(struct device *dev, void (*action)(void *), void *data);
289 int __devm_add_action(struct device *dev, void (*action)(void *), void *data, const char *name);
290 #define devm_add_action(dev, action, data) \ argument
291 __devm_add_action(dev, action, data, #action)
293 static inline int __devm_add_action_or_reset(struct device *dev, void (*action)(void *), in __devm_add_action_or_reset() argument
298 ret = __devm_add_action(dev, action, data, name); in __devm_add_action_or_reset()
304 #define devm_add_action_or_reset(dev, action, data) \ argument
305 __devm_add_action_or_reset(dev, action, data, #action)
318 #define devm_alloc_percpu(dev, type) \ argument
319 ((typeof(type) __percpu *)__devm_alloc_percpu((dev), sizeof(type), \
322 void __percpu *__devm_alloc_percpu(struct device *dev, size_t size,
324 void devm_free_percpu(struct device *dev, void __percpu *pdata);
687 void (*release)(struct device *dev);
761 static inline bool device_iommu_mapped(struct device *dev) in device_iommu_mapped() argument
763 return (dev->iommu_group != NULL); in device_iommu_mapped()
774 static inline const char *dev_name(const struct device *dev) in dev_name() argument
777 if (dev->init_name) in dev_name()
778 return dev->init_name; in dev_name()
780 return kobject_name(&dev->kobj); in dev_name()
790 static inline const char *dev_bus_name(const struct device *dev) in dev_bus_name() argument
792 return dev->bus ? dev->bus->name : (dev->class ? dev->class->name : ""); in dev_bus_name()
795 __printf(2, 3) int dev_set_name(struct device *dev, const char *name, ...);
798 static inline int dev_to_node(struct device *dev) in dev_to_node() argument
800 return dev->numa_node; in dev_to_node()
802 static inline void set_dev_node(struct device *dev, int node) in set_dev_node() argument
804 dev->numa_node = node; in set_dev_node()
807 static inline int dev_to_node(struct device *dev) in dev_to_node() argument
811 static inline void set_dev_node(struct device *dev, int node) in set_dev_node() argument
816 static inline struct irq_domain *dev_get_msi_domain(const struct device *dev) in dev_get_msi_domain() argument
819 return dev->msi.domain; in dev_get_msi_domain()
825 static inline void dev_set_msi_domain(struct device *dev, struct irq_domain *d) in dev_set_msi_domain() argument
828 dev->msi.domain = d; in dev_set_msi_domain()
832 static inline void *dev_get_drvdata(const struct device *dev) in dev_get_drvdata() argument
834 return dev->driver_data; in dev_get_drvdata()
837 static inline void dev_set_drvdata(struct device *dev, void *data) in dev_set_drvdata() argument
839 dev->driver_data = data; in dev_set_drvdata()
842 static inline struct pm_subsys_data *dev_to_psd(struct device *dev) in dev_to_psd() argument
844 return dev ? dev->power.subsys_data : NULL; in dev_to_psd()
847 static inline unsigned int dev_get_uevent_suppress(const struct device *dev) in dev_get_uevent_suppress() argument
849 return dev->kobj.uevent_suppress; in dev_get_uevent_suppress()
852 static inline void dev_set_uevent_suppress(struct device *dev, int val) in dev_set_uevent_suppress() argument
854 dev->kobj.uevent_suppress = val; in dev_set_uevent_suppress()
857 static inline int device_is_registered(struct device *dev) in device_is_registered() argument
859 return dev->kobj.state_in_sysfs; in device_is_registered()
862 static inline void device_enable_async_suspend(struct device *dev) in device_enable_async_suspend() argument
864 if (!dev->power.is_prepared) in device_enable_async_suspend()
865 dev->power.async_suspend = true; in device_enable_async_suspend()
868 static inline void device_disable_async_suspend(struct device *dev) in device_disable_async_suspend() argument
870 if (!dev->power.is_prepared) in device_disable_async_suspend()
871 dev->power.async_suspend = false; in device_disable_async_suspend()
874 static inline bool device_async_suspend_enabled(struct device *dev) in device_async_suspend_enabled() argument
876 return !!dev->power.async_suspend; in device_async_suspend_enabled()
879 static inline bool device_pm_not_required(struct device *dev) in device_pm_not_required() argument
881 return dev->power.no_pm; in device_pm_not_required()
884 static inline void device_set_pm_not_required(struct device *dev) in device_set_pm_not_required() argument
886 dev->power.no_pm = true; in device_set_pm_not_required()
888 dev->power.no_callbacks = true; in device_set_pm_not_required()
892 static inline void dev_pm_syscore_device(struct device *dev, bool val) in dev_pm_syscore_device() argument
895 dev->power.syscore = val; in dev_pm_syscore_device()
899 static inline void dev_pm_set_driver_flags(struct device *dev, u32 flags) in dev_pm_set_driver_flags() argument
901 dev->power.driver_flags = flags; in dev_pm_set_driver_flags()
904 static inline bool dev_pm_test_driver_flags(struct device *dev, u32 flags) in dev_pm_test_driver_flags() argument
906 return !!(dev->power.driver_flags & flags); in dev_pm_test_driver_flags()
909 static inline void device_lock(struct device *dev) in device_lock() argument
911 mutex_lock(&dev->mutex); in device_lock()
914 static inline int device_lock_interruptible(struct device *dev) in device_lock_interruptible() argument
916 return mutex_lock_interruptible(&dev->mutex); in device_lock_interruptible()
919 static inline int device_trylock(struct device *dev) in device_trylock() argument
921 return mutex_trylock(&dev->mutex); in device_trylock()
924 static inline void device_unlock(struct device *dev) in device_unlock() argument
926 mutex_unlock(&dev->mutex); in device_unlock()
931 static inline void device_lock_assert(struct device *dev) in DEFINE_GUARD()
933 lockdep_assert_held(&dev->mutex); in DEFINE_GUARD()
936 static inline bool dev_has_sync_state(struct device *dev) in dev_has_sync_state() argument
938 if (!dev) in dev_has_sync_state()
940 if (dev->driver && dev->driver->sync_state) in dev_has_sync_state()
942 if (dev->bus && dev->bus->sync_state) in dev_has_sync_state()
947 static inline void dev_set_removable(struct device *dev, in dev_set_removable() argument
950 dev->removable = removable; in dev_set_removable()
953 static inline bool dev_is_removable(struct device *dev) in dev_is_removable() argument
955 return dev->removable == DEVICE_REMOVABLE; in dev_is_removable()
958 static inline bool dev_removable_is_valid(struct device *dev) in dev_removable_is_valid() argument
960 return dev->removable != DEVICE_REMOVABLE_NOT_SUPPORTED; in dev_removable_is_valid()
966 int __must_check device_register(struct device *dev);
967 void device_unregister(struct device *dev);
968 void device_initialize(struct device *dev);
969 int __must_check device_add(struct device *dev);
970 void device_del(struct device *dev);
974 int device_for_each_child(struct device *dev, void *data,
975 int (*fn)(struct device *dev, void *data));
976 int device_for_each_child_reverse(struct device *dev, void *data,
977 int (*fn)(struct device *dev, void *data));
981 struct device *device_find_child(struct device *dev, void *data,
982 int (*match)(struct device *dev, void *data));
987 int device_rename(struct device *dev, const char *new_name);
988 int device_move(struct device *dev, struct device *new_parent,
990 int device_change_owner(struct device *dev, kuid_t kuid, kgid_t kgid);
992 static inline bool device_supports_offline(struct device *dev) in device_supports_offline() argument
994 return dev->bus && dev->bus->offline && dev->bus->online; in device_supports_offline()
997 #define __device_lock_set_class(dev, name, key) \ argument
999 struct device *__d2 __maybe_unused = dev; \
1014 #define device_lock_set_class(dev, key) \ argument
1016 struct device *__d = dev; \
1023 #define device_lock_set_class(dev, key) __device_lock_set_class(dev, #key, key) argument
1033 #define device_lock_reset_class(dev) \ argument
1035 struct device *__d __maybe_unused = dev; \
1043 int device_offline(struct device *dev);
1044 int device_online(struct device *dev);
1046 void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode);
1047 void set_secondary_fwnode(struct device *dev, struct fwnode_handle *fwnode);
1048 void device_set_node(struct device *dev, struct fwnode_handle *fwnode);
1049 void device_set_of_node_from_dev(struct device *dev, const struct device *dev2);
1051 static inline struct device_node *dev_of_node(struct device *dev) in dev_of_node() argument
1053 if (!IS_ENABLED(CONFIG_OF) || !dev) in dev_of_node()
1055 return dev->of_node; in dev_of_node()
1058 static inline int dev_num_vf(struct device *dev) in dev_num_vf() argument
1060 if (dev->bus && dev->bus->num_vf) in dev_num_vf()
1061 return dev->bus->num_vf(dev); in dev_num_vf()
1076 static inline void *dev_get_platdata(const struct device *dev) in dev_get_platdata() argument
1078 return dev->platform_data; in dev_get_platdata()
1086 struct device *dev);
1087 int __must_check device_bind_driver(struct device *dev);
1088 void device_release_driver(struct device *dev);
1089 int __must_check device_attach(struct device *dev);
1091 void device_initial_probe(struct device *dev);
1092 int __must_check device_reprobe(struct device *dev);
1094 bool device_is_bound(struct device *dev);
1108 int __must_check device_add_groups(struct device *dev,
1110 void device_remove_groups(struct device *dev,
1113 static inline int __must_check device_add_group(struct device *dev, in device_add_group() argument
1118 return device_add_groups(dev, groups); in device_add_group()
1121 static inline void device_remove_group(struct device *dev, in device_remove_group() argument
1126 return device_remove_groups(dev, groups); in device_remove_group()
1129 int __must_check devm_device_add_group(struct device *dev,
1136 struct device *get_device(struct device *dev);
1137 void put_device(struct device *dev);
1141 bool kill_device(struct device *dev);
1153 const char *dev_driver_string(const struct device *dev);