From: Linus Torvalds Date: Sat, 18 Aug 2018 18:44:53 +0000 (-0700) Subject: Merge tag 'driver-core-4.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git... X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=a18d783fedfe6f9b720afe901db9501ce116ed81;p=people%2Fpauldu%2Flinux.git Merge tag 'driver-core-4.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core Pull driver core updates from Greg KH: "Here are all of the driver core and related patches for 4.19-rc1. Nothing huge here, just a number of small cleanups and the ability to now stop the deferred probing after init happens. All of these have been in linux-next for a while with only a merge issue reported" * tag 'driver-core-4.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (21 commits) base: core: Remove WARN_ON from link dependencies check drivers/base: stop new probing during shutdown drivers: core: Remove glue dirs from sysfs earlier driver core: remove unnecessary function extern declare sysfs.h: fix non-kernel-doc comment PM / Domains: Stop deferring probe at the end of initcall iommu: Remove IOMMU_OF_DECLARE iommu: Stop deferring probe at end of initcalls pinctrl: Support stopping deferred probe after initcalls dt-bindings: pinctrl: add a 'pinctrl-use-default' property driver core: allow stopping deferred probe after init driver core: add a debugfs entry to show deferred devices sysfs: Fix internal_create_group() for named group updates base: fix order of OF initialization linux/device.h: fix kernel-doc notation warning Documentation: update firmware loader fallback reference kobject: Replace strncpy with memcpy drivers: base: cacheinfo: use OF property_read_u32 instead of get_property,read_number kernfs: Replace strncpy with memcpy device: Add #define dev_fmt similar to #define pr_fmt ... --- a18d783fedfe6f9b720afe901db9501ce116ed81 diff --cc fs/sysfs/group.c index c7a716c4acc9,38240410f831..1eb2d6307663 --- a/fs/sysfs/group.c +++ b/fs/sysfs/group.c @@@ -122,15 -118,23 +122,24 @@@ static int internal_create_group(struc kobj->name, grp->name ?: ""); return -EINVAL; } + kobject_get_ownership(kobj, &uid, &gid); if (grp->name) { - kn = kernfs_create_dir_ns(kobj->sd, grp->name, - S_IRWXU | S_IRUGO | S_IXUGO, - uid, gid, kobj, NULL); - if (IS_ERR(kn)) { - if (PTR_ERR(kn) == -EEXIST) - sysfs_warn_dup(kobj->sd, grp->name); - return PTR_ERR(kn); + if (update) { + kn = kernfs_find_and_get(kobj->sd, grp->name); + if (!kn) { + pr_warn("Can't update unknown attr grp name: %s/%s\n", + kobj->name, grp->name); + return -EINVAL; + } + } else { - kn = kernfs_create_dir(kobj->sd, grp->name, - S_IRWXU | S_IRUGO | S_IXUGO, - kobj); ++ kn = kernfs_create_dir_ns(kobj->sd, grp->name, ++ S_IRWXU | S_IRUGO | S_IXUGO, ++ uid, gid, kobj, NULL); + if (IS_ERR(kn)) { + if (PTR_ERR(kn) == -EEXIST) + sysfs_warn_dup(kobj->sd, grp->name); + return PTR_ERR(kn); + } } } else kn = kobj->sd; diff --cc include/linux/device.h index f6475b1820ef,d2acc78d279b..8f882549edee --- a/include/linux/device.h +++ b/include/linux/device.h @@@ -1327,32 -1318,35 +1329,36 @@@ extern const char *dev_driver_string(co struct device_link *device_link_add(struct device *consumer, struct device *supplier, u32 flags); void device_link_del(struct device_link *link); +void device_link_remove(void *consumer, struct device *supplier); + #ifndef dev_fmt + #define dev_fmt(fmt) fmt + #endif + #ifdef CONFIG_PRINTK - extern __printf(3, 0) + __printf(3, 0) int dev_vprintk_emit(int level, const struct device *dev, const char *fmt, va_list args); - extern __printf(3, 4) + __printf(3, 4) int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...); - extern __printf(3, 4) + __printf(3, 4) void dev_printk(const char *level, const struct device *dev, const char *fmt, ...); - extern __printf(2, 3) - void dev_emerg(const struct device *dev, const char *fmt, ...); - extern __printf(2, 3) - void dev_alert(const struct device *dev, const char *fmt, ...); - extern __printf(2, 3) - void dev_crit(const struct device *dev, const char *fmt, ...); - extern __printf(2, 3) - void dev_err(const struct device *dev, const char *fmt, ...); - extern __printf(2, 3) - void dev_warn(const struct device *dev, const char *fmt, ...); - extern __printf(2, 3) - void dev_notice(const struct device *dev, const char *fmt, ...); - extern __printf(2, 3) + __printf(2, 3) + void _dev_emerg(const struct device *dev, const char *fmt, ...); + __printf(2, 3) + void _dev_alert(const struct device *dev, const char *fmt, ...); + __printf(2, 3) + void _dev_crit(const struct device *dev, const char *fmt, ...); + __printf(2, 3) + void _dev_err(const struct device *dev, const char *fmt, ...); + __printf(2, 3) + void _dev_warn(const struct device *dev, const char *fmt, ...); + __printf(2, 3) + void _dev_notice(const struct device *dev, const char *fmt, ...); + __printf(2, 3) void _dev_info(const struct device *dev, const char *fmt, ...); #else diff --cc include/linux/kobject.h index b49ff230beba,270b40515e79..1ab0d624fb36 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h @@@ -115,10 -114,25 +115,27 @@@ extern struct kobject * __must_check ko extern void kobject_put(struct kobject *kobj); extern const void *kobject_namespace(struct kobject *kobj); +extern void kobject_get_ownership(struct kobject *kobj, + kuid_t *uid, kgid_t *gid); extern char *kobject_get_path(struct kobject *kobj, gfp_t flag); + /** + * kobject_has_children - Returns whether a kobject has children. + * @kobj: the object to test + * + * This will return whether a kobject has other kobjects as children. + * + * It does NOT account for the presence of attribute files, only sub + * directories. It also assumes there is no concurrent addition or + * removal of such children, and thus relies on external locking. + */ + static inline bool kobject_has_children(struct kobject *kobj) + { + WARN_ON_ONCE(kref_read(&kobj->kref) == 0); + + return kobj->sd && kobj->sd->dir.subdirs; + } + struct kobj_type { void (*release)(struct kobject *kobj); const struct sysfs_ops *sysfs_ops;