Commit 67dd0772 authored by Bartosz Golaszewski's avatar Bartosz Golaszewski Committed by Greg Kroah-Hartman

device: remove 'extern' attribute from function prototypes in device.h

Functions are declared 'extern' implicitly by the compiler. There's no
reason to prepend every prototype with it. Remove the 'extern' keyword
from all function declarations in linux/device.h.
Signed-off-by: default avatarBartosz Golaszewski <bgolaszewski@baylibre.com>
Link: https://lore.kernel.org/r/20200629065008.27620-4-brgl@bgdev.plSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent dc2a633c
...@@ -149,68 +149,66 @@ ssize_t device_store_bool(struct device *dev, struct device_attribute *attr, ...@@ -149,68 +149,66 @@ ssize_t device_store_bool(struct device *dev, struct device_attribute *attr,
struct device_attribute dev_attr_##_name = \ struct device_attribute dev_attr_##_name = \
__ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) __ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store)
extern int device_create_file(struct device *device, int device_create_file(struct device *device,
const struct device_attribute *entry); const struct device_attribute *entry);
extern void device_remove_file(struct device *dev, void device_remove_file(struct device *dev,
const struct device_attribute *attr); const struct device_attribute *attr);
extern bool device_remove_file_self(struct device *dev, bool device_remove_file_self(struct device *dev,
const struct device_attribute *attr); const struct device_attribute *attr);
extern int __must_check device_create_bin_file(struct device *dev, int __must_check device_create_bin_file(struct device *dev,
const struct bin_attribute *attr); const struct bin_attribute *attr);
extern void device_remove_bin_file(struct device *dev, void device_remove_bin_file(struct device *dev,
const struct bin_attribute *attr); const struct bin_attribute *attr);
/* device resource management */ /* device resource management */
typedef void (*dr_release_t)(struct device *dev, void *res); typedef void (*dr_release_t)(struct device *dev, void *res);
typedef int (*dr_match_t)(struct device *dev, void *res, void *match_data); typedef int (*dr_match_t)(struct device *dev, void *res, void *match_data);
#ifdef CONFIG_DEBUG_DEVRES #ifdef CONFIG_DEBUG_DEVRES
extern void *__devres_alloc_node(dr_release_t release, size_t size, gfp_t gfp, void *__devres_alloc_node(dr_release_t release, size_t size, gfp_t gfp,
int nid, const char *name) __malloc; int nid, const char *name) __malloc;
#define devres_alloc(release, size, gfp) \ #define devres_alloc(release, size, gfp) \
__devres_alloc_node(release, size, gfp, NUMA_NO_NODE, #release) __devres_alloc_node(release, size, gfp, NUMA_NO_NODE, #release)
#define devres_alloc_node(release, size, gfp, nid) \ #define devres_alloc_node(release, size, gfp, nid) \
__devres_alloc_node(release, size, gfp, nid, #release) __devres_alloc_node(release, size, gfp, nid, #release)
#else #else
extern void *devres_alloc_node(dr_release_t release, size_t size, gfp_t gfp, void *devres_alloc_node(dr_release_t release, size_t size,
int nid) __malloc; gfp_t gfp, int nid) __malloc;
static inline void *devres_alloc(dr_release_t release, size_t size, gfp_t gfp) static inline void *devres_alloc(dr_release_t release, size_t size, gfp_t gfp)
{ {
return devres_alloc_node(release, size, gfp, NUMA_NO_NODE); return devres_alloc_node(release, size, gfp, NUMA_NO_NODE);
} }
#endif #endif
extern void devres_for_each_res(struct device *dev, dr_release_t release, void devres_for_each_res(struct device *dev, dr_release_t release,
dr_match_t match, void *match_data, dr_match_t match, void *match_data,
void (*fn)(struct device *, void *, void *), void (*fn)(struct device *, void *, void *),
void *data); void *data);
extern void devres_free(void *res); void devres_free(void *res);
extern void devres_add(struct device *dev, void *res); void devres_add(struct device *dev, void *res);
extern void *devres_find(struct device *dev, dr_release_t release, void *devres_find(struct device *dev, dr_release_t release,
dr_match_t match, void *match_data); dr_match_t match, void *match_data);
extern void *devres_get(struct device *dev, void *new_res, void *devres_get(struct device *dev, void *new_res,
dr_match_t match, void *match_data); dr_match_t match, void *match_data);
extern void *devres_remove(struct device *dev, dr_release_t release, void *devres_remove(struct device *dev, dr_release_t release,
dr_match_t match, void *match_data); dr_match_t match, void *match_data);
extern int devres_destroy(struct device *dev, dr_release_t release, int devres_destroy(struct device *dev, dr_release_t release,
dr_match_t match, void *match_data); dr_match_t match, void *match_data);
extern int devres_release(struct device *dev, dr_release_t release, int devres_release(struct device *dev, dr_release_t release,
dr_match_t match, void *match_data); dr_match_t match, void *match_data);
/* devres group */ /* devres group */
extern void * __must_check devres_open_group(struct device *dev, void *id, void * __must_check devres_open_group(struct device *dev, void *id, gfp_t gfp);
gfp_t gfp); void devres_close_group(struct device *dev, void *id);
extern void devres_close_group(struct device *dev, void *id); void devres_remove_group(struct device *dev, void *id);
extern void devres_remove_group(struct device *dev, void *id); int devres_release_group(struct device *dev, void *id);
extern int devres_release_group(struct device *dev, void *id);
/* managed devm_k.alloc/kfree for device drivers */ /* managed devm_k.alloc/kfree for device drivers */
extern void *devm_kmalloc(struct device *dev, size_t size, gfp_t gfp) __malloc; void *devm_kmalloc(struct device *dev, size_t size, gfp_t gfp) __malloc;
extern __printf(3, 0) __printf(3, 0) char *devm_kvasprintf(struct device *dev, gfp_t gfp,
char *devm_kvasprintf(struct device *dev, gfp_t gfp, const char *fmt, const char *fmt, va_list ap) __malloc;
va_list ap) __malloc; __printf(3, 4) char *devm_kasprintf(struct device *dev, gfp_t gfp,
extern __printf(3, 4) const char *fmt, ...) __malloc;
char *devm_kasprintf(struct device *dev, gfp_t gfp, const char *fmt, ...) __malloc;
static inline void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp) static inline void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp)
{ {
return devm_kmalloc(dev, size, gfp | __GFP_ZERO); return devm_kmalloc(dev, size, gfp | __GFP_ZERO);
...@@ -230,16 +228,14 @@ static inline void *devm_kcalloc(struct device *dev, ...@@ -230,16 +228,14 @@ static inline void *devm_kcalloc(struct device *dev,
{ {
return devm_kmalloc_array(dev, n, size, flags | __GFP_ZERO); return devm_kmalloc_array(dev, n, size, flags | __GFP_ZERO);
} }
extern void devm_kfree(struct device *dev, const void *p); void devm_kfree(struct device *dev, const void *p);
extern char *devm_kstrdup(struct device *dev, const char *s, gfp_t gfp) __malloc; char *devm_kstrdup(struct device *dev, const char *s, gfp_t gfp) __malloc;
extern const char *devm_kstrdup_const(struct device *dev, const char *devm_kstrdup_const(struct device *dev, const char *s, gfp_t gfp);
const char *s, gfp_t gfp); void *devm_kmemdup(struct device *dev, const void *src, size_t len, gfp_t gfp);
extern void *devm_kmemdup(struct device *dev, const void *src, size_t len,
gfp_t gfp);
extern unsigned long devm_get_free_pages(struct device *dev, unsigned long devm_get_free_pages(struct device *dev,
gfp_t gfp_mask, unsigned int order); gfp_t gfp_mask, unsigned int order);
extern void devm_free_pages(struct device *dev, unsigned long addr); void devm_free_pages(struct device *dev, unsigned long addr);
void __iomem *devm_ioremap_resource(struct device *dev, void __iomem *devm_ioremap_resource(struct device *dev,
const struct resource *res); const struct resource *res);
...@@ -655,8 +651,7 @@ static inline const char *dev_name(const struct device *dev) ...@@ -655,8 +651,7 @@ static inline const char *dev_name(const struct device *dev)
return kobject_name(&dev->kobj); return kobject_name(&dev->kobj);
} }
extern __printf(2, 3) __printf(2, 3) int dev_set_name(struct device *dev, const char *name, ...);
int dev_set_name(struct device *dev, const char *name, ...);
#ifdef CONFIG_NUMA #ifdef CONFIG_NUMA
static inline int dev_to_node(struct device *dev) static inline int dev_to_node(struct device *dev)
...@@ -813,39 +808,38 @@ static inline bool dev_has_sync_state(struct device *dev) ...@@ -813,39 +808,38 @@ static inline bool dev_has_sync_state(struct device *dev)
/* /*
* High level routines for use by the bus drivers * High level routines for use by the bus drivers
*/ */
extern int __must_check device_register(struct device *dev); int __must_check device_register(struct device *dev);
extern void device_unregister(struct device *dev); void device_unregister(struct device *dev);
extern void device_initialize(struct device *dev); void device_initialize(struct device *dev);
extern int __must_check device_add(struct device *dev); int __must_check device_add(struct device *dev);
extern void device_del(struct device *dev); void device_del(struct device *dev);
extern int device_for_each_child(struct device *dev, void *data, int device_for_each_child(struct device *dev, void *data,
int (*fn)(struct device *dev, void *data)); int (*fn)(struct device *dev, void *data));
extern int device_for_each_child_reverse(struct device *dev, void *data, int device_for_each_child_reverse(struct device *dev, void *data,
int (*fn)(struct device *dev, void *data)); int (*fn)(struct device *dev, void *data));
extern struct device *device_find_child(struct device *dev, void *data, struct device *device_find_child(struct device *dev, void *data,
int (*match)(struct device *dev, void *data)); int (*match)(struct device *dev, void *data));
extern struct device *device_find_child_by_name(struct device *parent, struct device *device_find_child_by_name(struct device *parent,
const char *name); const char *name);
extern int device_rename(struct device *dev, const char *new_name); int device_rename(struct device *dev, const char *new_name);
extern int device_move(struct device *dev, struct device *new_parent, int device_move(struct device *dev, struct device *new_parent,
enum dpm_order dpm_order); enum dpm_order dpm_order);
extern int device_change_owner(struct device *dev, kuid_t kuid, kgid_t kgid); int device_change_owner(struct device *dev, kuid_t kuid, kgid_t kgid);
extern const char *device_get_devnode(struct device *dev, const char *device_get_devnode(struct device *dev, umode_t *mode, kuid_t *uid,
umode_t *mode, kuid_t *uid, kgid_t *gid, kgid_t *gid, const char **tmp);
const char **tmp);
static inline bool device_supports_offline(struct device *dev) static inline bool device_supports_offline(struct device *dev)
{ {
return dev->bus && dev->bus->offline && dev->bus->online; return dev->bus && dev->bus->offline && dev->bus->online;
} }
extern void lock_device_hotplug(void); void lock_device_hotplug(void);
extern void unlock_device_hotplug(void); void unlock_device_hotplug(void);
extern int lock_device_hotplug_sysfs(void); int lock_device_hotplug_sysfs(void);
extern int device_offline(struct device *dev); int device_offline(struct device *dev);
extern int device_online(struct device *dev); int device_online(struct device *dev);
extern void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode); void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode);
extern void set_secondary_fwnode(struct device *dev, struct fwnode_handle *fwnode); void set_secondary_fwnode(struct device *dev, struct fwnode_handle *fwnode);
void device_set_of_node_from_dev(struct device *dev, const struct device *dev2); void device_set_of_node_from_dev(struct device *dev, const struct device *dev2);
static inline int dev_num_vf(struct device *dev) static inline int dev_num_vf(struct device *dev)
...@@ -858,14 +852,13 @@ static inline int dev_num_vf(struct device *dev) ...@@ -858,14 +852,13 @@ static inline int dev_num_vf(struct device *dev)
/* /*
* Root device objects for grouping under /sys/devices * Root device objects for grouping under /sys/devices
*/ */
extern struct device *__root_device_register(const char *name, struct device *__root_device_register(const char *name, struct module *owner);
struct module *owner);
/* This is a macro to avoid include problems with THIS_MODULE */ /* This is a macro to avoid include problems with THIS_MODULE */
#define root_device_register(name) \ #define root_device_register(name) \
__root_device_register(name, THIS_MODULE) __root_device_register(name, THIS_MODULE)
extern void root_device_unregister(struct device *root); void root_device_unregister(struct device *root);
static inline void *dev_get_platdata(const struct device *dev) static inline void *dev_get_platdata(const struct device *dev)
{ {
...@@ -876,33 +869,31 @@ static inline void *dev_get_platdata(const struct device *dev) ...@@ -876,33 +869,31 @@ static inline void *dev_get_platdata(const struct device *dev)
* Manual binding of a device to driver. See drivers/base/bus.c * Manual binding of a device to driver. See drivers/base/bus.c
* for information on use. * for information on use.
*/ */
extern int __must_check device_bind_driver(struct device *dev); int __must_check device_bind_driver(struct device *dev);
extern void device_release_driver(struct device *dev); void device_release_driver(struct device *dev);
extern int __must_check device_attach(struct device *dev); int __must_check device_attach(struct device *dev);
extern int __must_check driver_attach(struct device_driver *drv); int __must_check driver_attach(struct device_driver *drv);
extern void device_initial_probe(struct device *dev); void device_initial_probe(struct device *dev);
extern int __must_check device_reprobe(struct device *dev); int __must_check device_reprobe(struct device *dev);
extern bool device_is_bound(struct device *dev); bool device_is_bound(struct device *dev);
/* /*
* Easy functions for dynamically creating devices on the fly * Easy functions for dynamically creating devices on the fly
*/ */
extern __printf(5, 6) __printf(5, 6) struct device *
struct device *device_create(struct class *cls, struct device *parent, device_create(struct class *cls, struct device *parent, dev_t devt,
dev_t devt, void *drvdata, void *drvdata, const char *fmt, ...);
const char *fmt, ...); __printf(6, 7) struct device *
extern __printf(6, 7) device_create_with_groups(struct class *cls, struct device *parent, dev_t devt,
struct device *device_create_with_groups(struct class *cls, void *drvdata, const struct attribute_group **groups,
struct device *parent, dev_t devt, void *drvdata, const char *fmt, ...);
const struct attribute_group **groups, void device_destroy(struct class *cls, dev_t devt);
const char *fmt, ...);
extern void device_destroy(struct class *cls, dev_t devt); int __must_check device_add_groups(struct device *dev,
const struct attribute_group **groups);
extern int __must_check device_add_groups(struct device *dev, void device_remove_groups(struct device *dev,
const struct attribute_group **groups); const struct attribute_group **groups);
extern void device_remove_groups(struct device *dev,
const struct attribute_group **groups);
static inline int __must_check device_add_group(struct device *dev, static inline int __must_check device_add_group(struct device *dev,
const struct attribute_group *grp) const struct attribute_group *grp)
...@@ -920,14 +911,14 @@ static inline void device_remove_group(struct device *dev, ...@@ -920,14 +911,14 @@ static inline void device_remove_group(struct device *dev,
return device_remove_groups(dev, groups); return device_remove_groups(dev, groups);
} }
extern int __must_check devm_device_add_groups(struct device *dev, int __must_check devm_device_add_groups(struct device *dev,
const struct attribute_group **groups); const struct attribute_group **groups);
extern void devm_device_remove_groups(struct device *dev, void devm_device_remove_groups(struct device *dev,
const struct attribute_group **groups); const struct attribute_group **groups);
extern int __must_check devm_device_add_group(struct device *dev, int __must_check devm_device_add_group(struct device *dev,
const struct attribute_group *grp); const struct attribute_group *grp);
extern void devm_device_remove_group(struct device *dev, void devm_device_remove_group(struct device *dev,
const struct attribute_group *grp); const struct attribute_group *grp);
/* /*
* Platform "fixup" functions - allow the platform to have their say * Platform "fixup" functions - allow the platform to have their say
...@@ -944,21 +935,21 @@ extern int (*platform_notify_remove)(struct device *dev); ...@@ -944,21 +935,21 @@ extern int (*platform_notify_remove)(struct device *dev);
* get_device - atomically increment the reference count for the device. * get_device - atomically increment the reference count for the device.
* *
*/ */
extern struct device *get_device(struct device *dev); struct device *get_device(struct device *dev);
extern void put_device(struct device *dev); void put_device(struct device *dev);
extern bool kill_device(struct device *dev); bool kill_device(struct device *dev);
#ifdef CONFIG_DEVTMPFS #ifdef CONFIG_DEVTMPFS
extern int devtmpfs_mount(void); int devtmpfs_mount(void);
#else #else
static inline int devtmpfs_mount(void) { return 0; } static inline int devtmpfs_mount(void) { return 0; }
#endif #endif
/* drivers/base/power/shutdown.c */ /* drivers/base/power/shutdown.c */
extern void device_shutdown(void); void device_shutdown(void);
/* debugging and troubleshooting/diagnostic helpers. */ /* debugging and troubleshooting/diagnostic helpers. */
extern const char *dev_driver_string(const struct device *dev); const char *dev_driver_string(const struct device *dev);
/* Device links interface. */ /* Device links interface. */
struct device_link *device_link_add(struct device *consumer, struct device_link *device_link_add(struct device *consumer,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment