On Wed, Jul 05, 2023 at 05:07:22PM +0200, Amadeusz Sławiński wrote:
On 7/5/2023 2:30 PM, Johan Hovold wrote:
Suppress probe deferral error messages when loading topologies and creating frontend links to avoid spamming the logs when a component has not yet been registered:
snd-sc8280xp sound: ASoC: adding FE link failed snd-sc8280xp sound: ASoC: topology: could not load header: -517
Note that dev_err_probe() is not used as the topology component can be probed and removed while the underlying platform device remains bound to its driver.
I'm not sure that I understand that argument... what's wrong with dev_err_probe(tplg->dev, err, "ASoC: adding FE link failed\n"); instead of dev_err(tplg->dev, "ASoC: adding FE link failed\n"); ?
In short, it is not correct to use dev_err_probe() here as this is not a probe function.
dev_err_probe() is tied to driver core and will specifically allocate and associate an error message with the struct device on probe deferrals, which is later freed when the struct device is bound to a driver (or released).
For ASoC drivers, the struct device is typically bound to a driver long before the components they register are "probed". I use quotation marks as this is not probing in the driver model sense of the word and the underlying struct device is already bound to a driver when the component is "probed".
Personally I would prefer dev_err_probe() to be used as it also provides debug message.
Yeah, but it would be conceptually wrong to do so (besides the fact that it would waste some memory).
Johan