Re: [PATCH v4 2/3] driver core: add deferring probe reason to devices_deferred property

From: Andrzej Hajda
Date: Thu Dec 20 2018 - 07:27:49 EST


On 20.12.2018 12:04, Rafael J. Wysocki wrote:
> On Thu, Dec 20, 2018 at 11:23 AM Andrzej Hajda <a.hajda@xxxxxxxxxxx> wrote:
>> /sys/kernel/debug/devices_deferred property contains list of deferred devices.
>> This list does not contain reason why the driver deferred probe, the patch
>> improves it.
>> The natural place to set the reason is probe_err function introduced recently,
>> ie. if probe_err will be called with -EPROBE_DEFER instead of printk the message
>> will be attached to deferred device and printed when user read devices_deferred
>> property.
>>
>> Signed-off-by: Andrzej Hajda <a.hajda@xxxxxxxxxxx>
>> Reviewed-by: Mark Brown <broonie@xxxxxxxxxx>
>> Reviewed-by: Javier Martinez Canillas <javierm@xxxxxxxxxx>
>> Reviewed-by: Andy Shevchenko <andy.shevchenko@xxxxxxxxx>
>> ---
>> v4:
>> - removed NULL check before kfree,
>> - coding style tweaking.
>> v3:
>> - adjusted deferred_devs_show, to accept newline ended messages,
>> - changed conditonal check to positive,
>> - added R-b by Andy.
>> v2:
>> - changed __deferred_probe_set_msg args - like in __dev_printk, fits better,
>> - use kasprintf instead of bunch of code,
>> - keep consistent format of devices_deferred lines,
>> - added R-Bs (again I hope changes above are not against it).
>> ---
>> ---
>> drivers/base/base.h | 3 +++
>> drivers/base/core.c | 9 +++++----
>> drivers/base/dd.c | 21 ++++++++++++++++++++-
>> 3 files changed, 28 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/base/base.h b/drivers/base/base.h
>> index 7a419a7a6235..effbd5e7f9f1 100644
>> --- a/drivers/base/base.h
>> +++ b/drivers/base/base.h
>> @@ -75,6 +75,7 @@ struct device_private {
>> struct klist_node knode_driver;
>> struct klist_node knode_bus;
>> struct list_head deferred_probe;
>> + char *deferred_probe_msg;
> Many drivers will never use this, so is the memory overhead justified?


I can try to move it somewhere else if it is a problem.

Putting it here seems quite natural - near deferred_probe field which
should have similar number of users.


Regards

Andrzej


>
>> struct device *device;
>> };
>