Skip to content

Commit c61529f

Browse files
committed
Merge tag 'driver-core-5.7-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
Pull driver core fixes from Greg KH: "Here are a number of small driver core fixes for 5.7-rc5 to resolve a bunch of reported issues with the current tree. Biggest here are the reverts and patches from John Stultz to resolve a bunch of deferred probe regressions we have been seeing in 5.7-rc right now. Along with those are some other smaller fixes: - coredump crash fix - devlink fix for when permissive mode was enabled - amba and platform device dma_parms fixes - component error silenced for when deferred probe happens All of these have been in linux-next for a while with no reported issues" * tag 'driver-core-5.7-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: regulator: Revert "Use driver_deferred_probe_timeout for regulator_init_complete_work" driver core: Ensure wait_for_device_probe() waits until the deferred_probe_timeout fires driver core: Use dev_warn() instead of dev_WARN() for deferred_probe_timeout warnings driver core: Revert default driver_deferred_probe_timeout value to 0 component: Silence bind error on -EPROBE_DEFER driver core: Fix handling of fw_devlink=permissive coredump: fix crash when umh is disabled amba: Initialize dma_parms for amba devices driver core: platform: Initialize dma_parms for platform devices
2 parents e7a1c73 + 2a15483 commit c61529f

File tree

10 files changed

+48
-30
lines changed

10 files changed

+48
-30
lines changed

drivers/amba/bus.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,7 @@ static void amba_device_initialize(struct amba_device *dev, const char *name)
645645
dev->dev.release = amba_device_release;
646646
dev->dev.bus = &amba_bustype;
647647
dev->dev.dma_mask = &dev->dev.coherent_dma_mask;
648+
dev->dev.dma_parms = &dev->dma_parms;
648649
dev->res.name = dev_name(&dev->dev);
649650
}
650651

drivers/base/component.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,8 @@ static int try_to_bring_up_master(struct master *master,
256256
ret = master->ops->bind(master->dev);
257257
if (ret < 0) {
258258
devres_release_group(master->dev, NULL);
259-
dev_info(master->dev, "master bind failed: %d\n", ret);
259+
if (ret != -EPROBE_DEFER)
260+
dev_info(master->dev, "master bind failed: %d\n", ret);
260261
return ret;
261262
}
262263

@@ -611,8 +612,9 @@ static int component_bind(struct component *component, struct master *master,
611612
devres_release_group(component->dev, NULL);
612613
devres_release_group(master->dev, NULL);
613614

614-
dev_err(master->dev, "failed to bind %s (ops %ps): %d\n",
615-
dev_name(component->dev), component->ops, ret);
615+
if (ret != -EPROBE_DEFER)
616+
dev_err(master->dev, "failed to bind %s (ops %ps): %d\n",
617+
dev_name(component->dev), component->ops, ret);
616618
}
617619

618620
return ret;

drivers/base/core.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2370,6 +2370,11 @@ u32 fw_devlink_get_flags(void)
23702370
return fw_devlink_flags;
23712371
}
23722372

2373+
static bool fw_devlink_is_permissive(void)
2374+
{
2375+
return fw_devlink_flags == DL_FLAG_SYNC_STATE_ONLY;
2376+
}
2377+
23732378
/**
23742379
* device_add - add device to device hierarchy.
23752380
* @dev: device.
@@ -2524,7 +2529,7 @@ int device_add(struct device *dev)
25242529
if (fw_devlink_flags && is_fwnode_dev &&
25252530
fwnode_has_op(dev->fwnode, add_links)) {
25262531
fw_ret = fwnode_call_int_op(dev->fwnode, add_links, dev);
2527-
if (fw_ret == -ENODEV)
2532+
if (fw_ret == -ENODEV && !fw_devlink_is_permissive())
25282533
device_link_wait_for_mandatory_supplier(dev);
25292534
else if (fw_ret)
25302535
device_link_wait_for_optional_supplier(dev);

drivers/base/dd.c

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -224,17 +224,9 @@ static int deferred_devs_show(struct seq_file *s, void *data)
224224
}
225225
DEFINE_SHOW_ATTRIBUTE(deferred_devs);
226226

227-
#ifdef CONFIG_MODULES
228-
/*
229-
* In the case of modules, set the default probe timeout to
230-
* 30 seconds to give userland some time to load needed modules
231-
*/
232-
int driver_deferred_probe_timeout = 30;
233-
#else
234-
/* In the case of !modules, no probe timeout needed */
235-
int driver_deferred_probe_timeout = -1;
236-
#endif
227+
int driver_deferred_probe_timeout;
237228
EXPORT_SYMBOL_GPL(driver_deferred_probe_timeout);
229+
static DECLARE_WAIT_QUEUE_HEAD(probe_timeout_waitqueue);
238230

239231
static int __init deferred_probe_timeout_setup(char *str)
240232
{
@@ -266,8 +258,8 @@ int driver_deferred_probe_check_state(struct device *dev)
266258
return -ENODEV;
267259
}
268260

269-
if (!driver_deferred_probe_timeout) {
270-
dev_WARN(dev, "deferred probe timeout, ignoring dependency");
261+
if (!driver_deferred_probe_timeout && initcalls_done) {
262+
dev_warn(dev, "deferred probe timeout, ignoring dependency");
271263
return -ETIMEDOUT;
272264
}
273265

@@ -284,6 +276,7 @@ static void deferred_probe_timeout_work_func(struct work_struct *work)
284276

285277
list_for_each_entry_safe(private, p, &deferred_probe_pending_list, deferred_probe)
286278
dev_info(private->device, "deferred probe pending");
279+
wake_up(&probe_timeout_waitqueue);
287280
}
288281
static DECLARE_DELAYED_WORK(deferred_probe_timeout_work, deferred_probe_timeout_work_func);
289282

@@ -658,6 +651,9 @@ int driver_probe_done(void)
658651
*/
659652
void wait_for_device_probe(void)
660653
{
654+
/* wait for probe timeout */
655+
wait_event(probe_timeout_waitqueue, !driver_deferred_probe_timeout);
656+
661657
/* wait for the deferred probe workqueue to finish */
662658
flush_work(&deferred_probe_work);
663659

drivers/base/platform.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,8 @@ struct platform_object {
380380
*/
381381
static void setup_pdev_dma_masks(struct platform_device *pdev)
382382
{
383+
pdev->dev.dma_parms = &pdev->dma_parms;
384+
383385
if (!pdev->dev.coherent_dma_mask)
384386
pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
385387
if (!pdev->dev.dma_mask) {

drivers/regulator/core.c

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5754,10 +5754,6 @@ static DECLARE_DELAYED_WORK(regulator_init_complete_work,
57545754

57555755
static int __init regulator_init_complete(void)
57565756
{
5757-
int delay = driver_deferred_probe_timeout;
5758-
5759-
if (delay < 0)
5760-
delay = 0;
57615757
/*
57625758
* Since DT doesn't provide an idiomatic mechanism for
57635759
* enabling full constraints and since it's much more natural
@@ -5768,17 +5764,18 @@ static int __init regulator_init_complete(void)
57685764
has_full_constraints = true;
57695765

57705766
/*
5771-
* If driver_deferred_probe_timeout is set, we punt
5772-
* completion for that many seconds since systems like
5773-
* distros will load many drivers from userspace so consumers
5774-
* might not always be ready yet, this is particularly an
5775-
* issue with laptops where this might bounce the display off
5776-
* then on. Ideally we'd get a notification from userspace
5777-
* when this happens but we don't so just wait a bit and hope
5778-
* we waited long enough. It'd be better if we'd only do
5779-
* this on systems that need it.
5767+
* We punt completion for an arbitrary amount of time since
5768+
* systems like distros will load many drivers from userspace
5769+
* so consumers might not always be ready yet, this is
5770+
* particularly an issue with laptops where this might bounce
5771+
* the display off then on. Ideally we'd get a notification
5772+
* from userspace when this happens but we don't so just wait
5773+
* a bit and hope we waited long enough. It'd be better if
5774+
* we'd only do this on systems that need it, and a kernel
5775+
* command line option might be useful.
57805776
*/
5781-
schedule_delayed_work(&regulator_init_complete_work, delay * HZ);
5777+
schedule_delayed_work(&regulator_init_complete_work,
5778+
msecs_to_jiffies(30000));
57825779

57835780
return 0;
57845781
}

fs/coredump.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -788,6 +788,14 @@ void do_coredump(const kernel_siginfo_t *siginfo)
788788
if (displaced)
789789
put_files_struct(displaced);
790790
if (!dump_interrupted()) {
791+
/*
792+
* umh disabled with CONFIG_STATIC_USERMODEHELPER_PATH="" would
793+
* have this set to NULL.
794+
*/
795+
if (!cprm.file) {
796+
pr_info("Core dump to |%s disabled\n", cn.corename);
797+
goto close_fail;
798+
}
791799
file_start_write(cprm.file);
792800
core_dumped = binfmt->core_dump(&cprm);
793801
file_end_write(cprm.file);

include/linux/amba/bus.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ struct amba_device {
6565
struct device dev;
6666
struct resource res;
6767
struct clk *pclk;
68+
struct device_dma_parameters dma_parms;
6869
unsigned int periphid;
6970
unsigned int cid;
7071
struct amba_cs_uci_id uci;

include/linux/platform_device.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ struct platform_device {
2525
bool id_auto;
2626
struct device dev;
2727
u64 platform_dma_mask;
28+
struct device_dma_parameters dma_parms;
2829
u32 num_resources;
2930
struct resource *resource;
3031

kernel/umh.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,11 @@ EXPORT_SYMBOL_GPL(fork_usermode_blob);
544544
* Runs a user-space application. The application is started
545545
* asynchronously if wait is not set, and runs as a child of system workqueues.
546546
* (ie. it runs with full root capabilities and optimized affinity).
547+
*
548+
* Note: successful return value does not guarantee the helper was called at
549+
* all. You can't rely on sub_info->{init,cleanup} being called even for
550+
* UMH_WAIT_* wait modes as STATIC_USERMODEHELPER_PATH="" turns all helpers
551+
* into a successful no-op.
547552
*/
548553
int call_usermodehelper_exec(struct subprocess_info *sub_info, int wait)
549554
{

0 commit comments

Comments
 (0)