On Mon, Jun 29, 2020 at 2:22 PM Andrzej Hajda <[email protected]> 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 dev_err_probe function introduced recently,
> ie. if dev_err_probe will be called with -EPROBE_DEFER instead of printk the message
> will be attached to deferred device and printed when user read devices_deferred
to a deferred
reads
> property.
...
> @@ -3984,10 +3986,12 @@ int dev_err_probe(const struct device *dev, int err, const char *fmt, ...)
> vaf.fmt = fmt;
> vaf.va = &args;
>
> - if (err != -EPROBE_DEFER)
> + if (err != -EPROBE_DEFER) {
Why not positive conditional? (Okay, I'm fine with either in this case)
> dev_err(dev, "error %d: %pV", err, &vaf);
> - else
> + } else {
> + device_set_deferred_probe_reson(dev, &vaf);
> dev_dbg(dev, "error %d: %pV", err, &vaf);
> + }
To reduce churn, you may move {} addition to the first patch.
...
> list_for_each_entry(curr, &deferred_probe_pending_list, deferred_probe)
> - seq_printf(s, "%s\n", dev_name(curr->device));
> + seq_printf(s, "%s\t%s", dev_name(curr->device),
> + curr->device->p->deferred_probe_reason ?: "\n");
Hmm... "\t" will be dangling in the latter case.
--
With Best Regards,
Andy Shevchenko
On 29.06.2020 18:36, Andy Shevchenko wrote:
> On Mon, Jun 29, 2020 at 2:22 PM Andrzej Hajda <[email protected]> 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 dev_err_probe function introduced recently,
>> ie. if dev_err_probe will be called with -EPROBE_DEFER instead of printk the message
>> will be attached to deferred device and printed when user read devices_deferred
> to a deferred
>
> reads
OK, thx.
>
>> property.
> ...
>
>> @@ -3984,10 +3986,12 @@ int dev_err_probe(const struct device *dev, int err, const char *fmt, ...)
>> vaf.fmt = fmt;
>> vaf.va = &args;
>>
>> - if (err != -EPROBE_DEFER)
>> + if (err != -EPROBE_DEFER) {
> Why not positive conditional? (Okay, I'm fine with either in this case)
I put more natural branch 1st.
>
>> dev_err(dev, "error %d: %pV", err, &vaf);
>> - else
>> + } else {
>> + device_set_deferred_probe_reson(dev, &vaf);
>> dev_dbg(dev, "error %d: %pV", err, &vaf);
>> + }
> To reduce churn, you may move {} addition to the first patch.
But then I need to explain why it is there :)
>
> ...
>
>> list_for_each_entry(curr, &deferred_probe_pending_list, deferred_probe)
>> - seq_printf(s, "%s\n", dev_name(curr->device));
>> + seq_printf(s, "%s\t%s", dev_name(curr->device),
>> + curr->device->p->deferred_probe_reason ?: "\n");
> Hmm... "\t" will be dangling in the latter case
Hmm, I followed your advice [1] :)
[1]:
https://www.mail-archive.com/[email protected]/msg1787370.html
Regards
Andrzej
>
On Tue, Jun 30, 2020 at 11:32 AM Andrzej Hajda <[email protected]> wrote:
> On 29.06.2020 18:36, Andy Shevchenko wrote:
> > On Mon, Jun 29, 2020 at 2:22 PM Andrzej Hajda <[email protected]> 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 dev_err_probe function introduced recently,
> >> ie. if dev_err_probe will be called with -EPROBE_DEFER instead of printk the message
> >> will be attached to deferred device and printed when user read devices_deferred
> > to a deferred
> >
> > reads
> OK, thx.
> >
> >> property.
...
> >> list_for_each_entry(curr, &deferred_probe_pending_list, deferred_probe)
> >> - seq_printf(s, "%s\n", dev_name(curr->device));
> >> + seq_printf(s, "%s\t%s", dev_name(curr->device),
> >> + curr->device->p->deferred_probe_reason ?: "\n");
> > Hmm... "\t" will be dangling in the latter case
>
>
> Hmm, I followed your advice [1] :)
>
> [1]:
> https://www.mail-archive.com/[email protected]/msg1787370.html
Ah, indeed :-)
Okay, as I said I'm fine with the code. Since it's debugfs, we are fine.
--
With Best Regards,
Andy Shevchenko