Skip to content

Commit 241590e

Browse files
committed
Merge tag 'driver-core-6.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
Pull driver core updates from Greg KH: "Here is the "big" set of driver core and kernfs changes for 6.9-rc1. Nothing all that crazy here, just some good updates that include: - automatic attribute group hiding from Dan Williams (he fixed up my horrible attempt at doing this.) - kobject lock contention fixes from Eric Dumazet - driver core cleanups from Andy - kernfs rcu work from Tejun - fw_devlink changes to resolve some reported issues - other minor changes, all details in the shortlog All of these have been in linux-next for a long time with no reported issues" * tag 'driver-core-6.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (28 commits) device: core: Log warning for devices pending deferred probe on timeout driver: core: Use dev_* instead of pr_* so device metadata is added driver: core: Log probe failure as error and with device metadata of: property: fw_devlink: Add support for "post-init-providers" property driver core: Add FWLINK_FLAG_IGNORE to completely ignore a fwnode link driver core: Adds flags param to fwnode_link_add() debugfs: fix wait/cancellation handling during remove device property: Don't use "proxy" headers device property: Move enum dev_dma_attr to fwnode.h driver core: Move fw_devlink stuff to where it belongs driver core: Drop unneeded 'extern' keyword in fwnode.h firmware_loader: Suppress warning on FW_OPT_NO_WARN flag sysfs:Addresses documentation in sysfs_merge_group and sysfs_unmerge_group. firmware_loader: introduce __free() cleanup hanler platform-msi: Remove usage of the deprecated ida_simple_xx() API sysfs: Introduce DEFINE_SIMPLE_SYSFS_GROUP_VISIBLE() sysfs: Document new "group visible" helpers sysfs: Fix crash on empty group attributes array sysfs: Introduce a mechanism to hide static attribute_groups sysfs: Introduce a mechanism to hide static attribute_groups ...
2 parents bb41fe3 + 6aeb885 commit 241590e

File tree

25 files changed

+387
-177
lines changed

25 files changed

+387
-177
lines changed

drivers/base/component.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ static int __component_add(struct device *dev, const struct component_ops *ops,
751751
* component_bind_all(). See also &struct component_ops.
752752
*
753753
* @subcomponent must be nonzero and is used to differentiate between multiple
754-
* components registerd on the same device @dev. These components are match
754+
* components registered on the same device @dev. These components are match
755755
* using component_match_add_typed().
756756
*
757757
* The component needs to be unregistered at driver unload/disconnect by
@@ -781,7 +781,7 @@ EXPORT_SYMBOL_GPL(component_add_typed);
781781
* The component needs to be unregistered at driver unload/disconnect by
782782
* calling component_del().
783783
*
784-
* See also component_add_typed() for a variant that allows multipled different
784+
* See also component_add_typed() for a variant that allows multiple different
785785
* components on the same device.
786786
*/
787787
int component_add(struct device *dev, const struct component_ops *ops)

drivers/base/core.c

Lines changed: 69 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,13 @@ static int __fwnode_link_add(struct fwnode_handle *con,
9292
return 0;
9393
}
9494

95-
int fwnode_link_add(struct fwnode_handle *con, struct fwnode_handle *sup)
95+
int fwnode_link_add(struct fwnode_handle *con, struct fwnode_handle *sup,
96+
u8 flags)
9697
{
9798
int ret;
9899

99100
mutex_lock(&fwnode_link_lock);
100-
ret = __fwnode_link_add(con, sup, 0);
101+
ret = __fwnode_link_add(con, sup, flags);
101102
mutex_unlock(&fwnode_link_lock);
102103
return ret;
103104
}
@@ -1011,7 +1012,8 @@ static struct fwnode_handle *fwnode_links_check_suppliers(
10111012
return NULL;
10121013

10131014
list_for_each_entry(link, &fwnode->suppliers, c_hook)
1014-
if (!(link->flags & FWLINK_FLAG_CYCLE))
1015+
if (!(link->flags &
1016+
(FWLINK_FLAG_CYCLE | FWLINK_FLAG_IGNORE)))
10151017
return link->supplier;
10161018

10171019
return NULL;
@@ -1871,6 +1873,7 @@ static void fw_devlink_unblock_consumers(struct device *dev)
18711873
device_links_write_unlock();
18721874
}
18731875

1876+
#define get_dev_from_fwnode(fwnode) get_device((fwnode)->dev)
18741877

18751878
static bool fwnode_init_without_drv(struct fwnode_handle *fwnode)
18761879
{
@@ -1901,6 +1904,63 @@ static bool fwnode_ancestor_init_without_drv(struct fwnode_handle *fwnode)
19011904
return false;
19021905
}
19031906

1907+
/**
1908+
* fwnode_is_ancestor_of - Test if @ancestor is ancestor of @child
1909+
* @ancestor: Firmware which is tested for being an ancestor
1910+
* @child: Firmware which is tested for being the child
1911+
*
1912+
* A node is considered an ancestor of itself too.
1913+
*
1914+
* Return: true if @ancestor is an ancestor of @child. Otherwise, returns false.
1915+
*/
1916+
static bool fwnode_is_ancestor_of(const struct fwnode_handle *ancestor,
1917+
const struct fwnode_handle *child)
1918+
{
1919+
struct fwnode_handle *parent;
1920+
1921+
if (IS_ERR_OR_NULL(ancestor))
1922+
return false;
1923+
1924+
if (child == ancestor)
1925+
return true;
1926+
1927+
fwnode_for_each_parent_node(child, parent) {
1928+
if (parent == ancestor) {
1929+
fwnode_handle_put(parent);
1930+
return true;
1931+
}
1932+
}
1933+
return false;
1934+
}
1935+
1936+
/**
1937+
* fwnode_get_next_parent_dev - Find device of closest ancestor fwnode
1938+
* @fwnode: firmware node
1939+
*
1940+
* Given a firmware node (@fwnode), this function finds its closest ancestor
1941+
* firmware node that has a corresponding struct device and returns that struct
1942+
* device.
1943+
*
1944+
* The caller is responsible for calling put_device() on the returned device
1945+
* pointer.
1946+
*
1947+
* Return: a pointer to the device of the @fwnode's closest ancestor.
1948+
*/
1949+
static struct device *fwnode_get_next_parent_dev(const struct fwnode_handle *fwnode)
1950+
{
1951+
struct fwnode_handle *parent;
1952+
struct device *dev;
1953+
1954+
fwnode_for_each_parent_node(fwnode, parent) {
1955+
dev = get_dev_from_fwnode(parent);
1956+
if (dev) {
1957+
fwnode_handle_put(parent);
1958+
return dev;
1959+
}
1960+
}
1961+
return NULL;
1962+
}
1963+
19041964
/**
19051965
* __fw_devlink_relax_cycles - Relax and mark dependency cycles.
19061966
* @con: Potential consumer device.
@@ -1962,6 +2022,9 @@ static bool __fw_devlink_relax_cycles(struct device *con,
19622022
}
19632023

19642024
list_for_each_entry(link, &sup_handle->suppliers, c_hook) {
2025+
if (link->flags & FWLINK_FLAG_IGNORE)
2026+
continue;
2027+
19652028
if (__fw_devlink_relax_cycles(con, link->supplier)) {
19662029
__fwnode_link_cycle(link);
19672030
ret = true;
@@ -2040,6 +2103,9 @@ static int fw_devlink_create_devlink(struct device *con,
20402103
int ret = 0;
20412104
u32 flags;
20422105

2106+
if (link->flags & FWLINK_FLAG_IGNORE)
2107+
return 0;
2108+
20432109
if (con->fwnode == link->consumer)
20442110
flags = fw_devlink_get_flags(link->flags);
20452111
else

drivers/base/cpu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ static int cpu_uevent(const struct device *dev, struct kobj_uevent_env *env)
366366
}
367367
#endif
368368

369-
struct bus_type cpu_subsys = {
369+
const struct bus_type cpu_subsys = {
370370
.name = "cpu",
371371
.dev_name = "cpu",
372372
.match = cpu_subsys_match,

drivers/base/dd.c

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ static void deferred_probe_timeout_work_func(struct work_struct *work)
313313

314314
mutex_lock(&deferred_probe_mutex);
315315
list_for_each_entry(p, &deferred_probe_pending_list, deferred_probe)
316-
dev_info(p->device, "deferred probe pending: %s", p->deferred_probe_reason ?: "(reason unknown)\n");
316+
dev_warn(p->device, "deferred probe pending: %s", p->deferred_probe_reason ?: "(reason unknown)\n");
317317
mutex_unlock(&deferred_probe_mutex);
318318

319319
fw_devlink_probing_done();
@@ -397,13 +397,12 @@ bool device_is_bound(struct device *dev)
397397
static void driver_bound(struct device *dev)
398398
{
399399
if (device_is_bound(dev)) {
400-
pr_warn("%s: device %s already bound\n",
401-
__func__, kobject_name(&dev->kobj));
400+
dev_warn(dev, "%s: device already bound\n", __func__);
402401
return;
403402
}
404403

405-
pr_debug("driver: '%s': %s: bound to device '%s'\n", dev->driver->name,
406-
__func__, dev_name(dev));
404+
dev_dbg(dev, "driver: '%s': %s: bound to device\n", dev->driver->name,
405+
__func__);
407406

408407
klist_add_tail(&dev->p->knode_driver, &dev->driver->p->klist_devices);
409408
device_links_driver_bound(dev);
@@ -587,13 +586,13 @@ static int call_driver_probe(struct device *dev, struct device_driver *drv)
587586
break;
588587
case -ENODEV:
589588
case -ENXIO:
590-
pr_debug("%s: probe of %s rejects match %d\n",
591-
drv->name, dev_name(dev), ret);
589+
dev_dbg(dev, "probe with driver %s rejects match %d\n",
590+
drv->name, ret);
592591
break;
593592
default:
594593
/* driver matched but the probe failed */
595-
pr_warn("%s: probe of %s failed with error %d\n",
596-
drv->name, dev_name(dev), ret);
594+
dev_err(dev, "probe with driver %s failed with error %d\n",
595+
drv->name, ret);
597596
break;
598597
}
599598

@@ -620,8 +619,8 @@ static int really_probe(struct device *dev, struct device_driver *drv)
620619
if (link_ret == -EPROBE_DEFER)
621620
return link_ret;
622621

623-
pr_debug("bus: '%s': %s: probing driver %s with device %s\n",
624-
drv->bus->name, __func__, drv->name, dev_name(dev));
622+
dev_dbg(dev, "bus: '%s': %s: probing driver %s with device\n",
623+
drv->bus->name, __func__, drv->name);
625624
if (!list_empty(&dev->devres_head)) {
626625
dev_crit(dev, "Resources present before probing\n");
627626
ret = -EBUSY;
@@ -644,8 +643,7 @@ static int really_probe(struct device *dev, struct device_driver *drv)
644643

645644
ret = driver_sysfs_add(dev);
646645
if (ret) {
647-
pr_err("%s: driver_sysfs_add(%s) failed\n",
648-
__func__, dev_name(dev));
646+
dev_err(dev, "%s: driver_sysfs_add failed\n", __func__);
649647
goto sysfs_failed;
650648
}
651649

@@ -706,8 +704,8 @@ static int really_probe(struct device *dev, struct device_driver *drv)
706704
dev->pm_domain->sync(dev);
707705

708706
driver_bound(dev);
709-
pr_debug("bus: '%s': %s: bound device %s to driver %s\n",
710-
drv->bus->name, __func__, dev_name(dev), drv->name);
707+
dev_dbg(dev, "bus: '%s': %s: bound device to driver %s\n",
708+
drv->bus->name, __func__, drv->name);
711709
goto done;
712710

713711
dev_sysfs_state_synced_failed:
@@ -786,8 +784,8 @@ static int __driver_probe_device(struct device_driver *drv, struct device *dev)
786784
return -EBUSY;
787785

788786
dev->can_match = true;
789-
pr_debug("bus: '%s': %s: matched device %s with driver %s\n",
790-
drv->bus->name, __func__, dev_name(dev), drv->name);
787+
dev_dbg(dev, "bus: '%s': %s: matched device with driver %s\n",
788+
drv->bus->name, __func__, drv->name);
791789

792790
pm_runtime_get_suppliers(dev);
793791
if (dev->parent)

drivers/base/firmware_loader/main.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -551,12 +551,16 @@ fw_get_filesystem_firmware(struct device *device, struct fw_priv *fw_priv,
551551
file_size_ptr,
552552
READING_FIRMWARE);
553553
if (rc < 0) {
554-
if (rc != -ENOENT)
555-
dev_warn(device, "loading %s failed with error %d\n",
556-
path, rc);
557-
else
558-
dev_dbg(device, "loading %s failed for no such file or directory.\n",
559-
path);
554+
if (!(fw_priv->opt_flags & FW_OPT_NO_WARN)) {
555+
if (rc != -ENOENT)
556+
dev_warn(device,
557+
"loading %s failed with error %d\n",
558+
path, rc);
559+
else
560+
dev_dbg(device,
561+
"loading %s failed for no such file or directory.\n",
562+
path);
563+
}
560564
continue;
561565
}
562566
size = rc;

drivers/base/platform-msi.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ static int platform_msi_alloc_priv_data(struct device *dev, unsigned int nvec,
174174
if (!datap)
175175
return -ENOMEM;
176176

177-
datap->devid = ida_simple_get(&platform_msi_devid_ida,
178-
0, 1 << DEV_ID_SHIFT, GFP_KERNEL);
177+
datap->devid = ida_alloc_max(&platform_msi_devid_ida,
178+
(1 << DEV_ID_SHIFT) - 1, GFP_KERNEL);
179179
if (datap->devid < 0) {
180180
err = datap->devid;
181181
kfree(datap);
@@ -193,7 +193,7 @@ static void platform_msi_free_priv_data(struct device *dev)
193193
struct platform_msi_priv_data *data = dev->msi.data->platform_data;
194194

195195
dev->msi.data->platform_data = NULL;
196-
ida_simple_remove(&platform_msi_devid_ida, data->devid);
196+
ida_free(&platform_msi_devid_ida, data->devid);
197197
kfree(data);
198198
}
199199

drivers/base/property.c

Lines changed: 6 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@
77
* Mika Westerberg <[email protected]>
88
*/
99

10-
#include <linux/acpi.h>
10+
#include <linux/device.h>
11+
#include <linux/err.h>
1112
#include <linux/export.h>
12-
#include <linux/kernel.h>
13+
#include <linux/kconfig.h>
1314
#include <linux/of.h>
14-
#include <linux/of_address.h>
15-
#include <linux/of_graph.h>
16-
#include <linux/of_irq.h>
1715
#include <linux/property.h>
1816
#include <linux/phy.h>
17+
#include <linux/slab.h>
18+
#include <linux/string.h>
19+
#include <linux/types.h>
1920

2021
struct fwnode_handle *__dev_fwnode(struct device *dev)
2122
{
@@ -699,34 +700,6 @@ struct fwnode_handle *fwnode_get_next_parent(struct fwnode_handle *fwnode)
699700
}
700701
EXPORT_SYMBOL_GPL(fwnode_get_next_parent);
701702

702-
/**
703-
* fwnode_get_next_parent_dev - Find device of closest ancestor fwnode
704-
* @fwnode: firmware node
705-
*
706-
* Given a firmware node (@fwnode), this function finds its closest ancestor
707-
* firmware node that has a corresponding struct device and returns that struct
708-
* device.
709-
*
710-
* The caller is responsible for calling put_device() on the returned device
711-
* pointer.
712-
*
713-
* Return: a pointer to the device of the @fwnode's closest ancestor.
714-
*/
715-
struct device *fwnode_get_next_parent_dev(const struct fwnode_handle *fwnode)
716-
{
717-
struct fwnode_handle *parent;
718-
struct device *dev;
719-
720-
fwnode_for_each_parent_node(fwnode, parent) {
721-
dev = get_dev_from_fwnode(parent);
722-
if (dev) {
723-
fwnode_handle_put(parent);
724-
return dev;
725-
}
726-
}
727-
return NULL;
728-
}
729-
730703
/**
731704
* fwnode_count_parents - Return the number of parents a node has
732705
* @fwnode: The node the parents of which are to be counted
@@ -773,34 +746,6 @@ struct fwnode_handle *fwnode_get_nth_parent(struct fwnode_handle *fwnode,
773746
}
774747
EXPORT_SYMBOL_GPL(fwnode_get_nth_parent);
775748

776-
/**
777-
* fwnode_is_ancestor_of - Test if @ancestor is ancestor of @child
778-
* @ancestor: Firmware which is tested for being an ancestor
779-
* @child: Firmware which is tested for being the child
780-
*
781-
* A node is considered an ancestor of itself too.
782-
*
783-
* Return: true if @ancestor is an ancestor of @child. Otherwise, returns false.
784-
*/
785-
bool fwnode_is_ancestor_of(const struct fwnode_handle *ancestor, const struct fwnode_handle *child)
786-
{
787-
struct fwnode_handle *parent;
788-
789-
if (IS_ERR_OR_NULL(ancestor))
790-
return false;
791-
792-
if (child == ancestor)
793-
return true;
794-
795-
fwnode_for_each_parent_node(child, parent) {
796-
if (parent == ancestor) {
797-
fwnode_handle_put(parent);
798-
return true;
799-
}
800-
}
801-
return false;
802-
}
803-
804749
/**
805750
* fwnode_get_next_child_node - Return the next child node handle for a node
806751
* @fwnode: Firmware node to find the next child node for.

drivers/base/swnode.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,21 @@
66
* Author: Heikki Krogerus <[email protected]>
77
*/
88

9+
#include <linux/container_of.h>
910
#include <linux/device.h>
10-
#include <linux/kernel.h>
11+
#include <linux/err.h>
12+
#include <linux/export.h>
13+
#include <linux/idr.h>
14+
#include <linux/init.h>
15+
#include <linux/kobject.h>
16+
#include <linux/kstrtox.h>
17+
#include <linux/list.h>
1118
#include <linux/property.h>
1219
#include <linux/slab.h>
20+
#include <linux/spinlock.h>
21+
#include <linux/string.h>
22+
#include <linux/sysfs.h>
23+
#include <linux/types.h>
1324

1425
#include "base.h"
1526

drivers/firmware/efi/sysfb_efi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ static int efifb_add_links(struct fwnode_handle *fwnode)
336336
if (!sup_np)
337337
return 0;
338338

339-
fwnode_link_add(fwnode, of_fwnode_handle(sup_np));
339+
fwnode_link_add(fwnode, of_fwnode_handle(sup_np), 0);
340340
of_node_put(sup_np);
341341

342342
return 0;

0 commit comments

Comments
 (0)