On 20/11/2024 15:19, Krzysztof Kozlowski wrote: > On 20/11/2024 15:07, Bartosz Golaszewski wrote: >>> diff --git a/drivers/firmware/qcom/qcom_scm.c b/drivers/firmware/qcom/qcom_scm.c >>> index 5d91b8e22844608f35432f1ba9c08d477d4ff762..93212c8f20ad65ecc44804b00f4b93e3eaaf8d95 100644 >>> --- a/drivers/firmware/qcom/qcom_scm.c >>> +++ b/drivers/firmware/qcom/qcom_scm.c >>> @@ -1075,6 +1075,9 @@ int qcom_scm_assign_mem(phys_addr_t mem_addr, size_t mem_sz, >>> int ret, i, b; >>> u64 srcvm_bits = *srcvm; >>> >>> + if (!qcom_scm_is_available()) >>> + return -EPROBE_DEFER; >>> + >> >> Should we be returning -EPROBE_DEFER from functions that are not >> necessarily limited to being used in probe()? For instance ath10k uses >> it in a workqueue job. I think this is why this driver is probed in One more here: qcom_scm_assign_mem() is used in both contexts: probe() and some other cases like mentioned workqueue. EAGAIN for probe() would not result in defered probe, I think. >> subsys_initcall() rather than module_initcall(). > Uh, good point. To my understanding, every resource like function can do > it, e.g. clk_get. Whether drivers call it in probe() or somewhere else - > e.g. some startup call like there is plenty in the ASoC or DMA > device_alloc_chan_resources() - is responsibility of the > driver/consumer, not the provider of that resource. > > With such explanation returning EPROBE_DEFER is ok, just like returning > anything else (e.g. EINVAL). > > Now about this function: it is not exactly "get a resource" one, but > still the caller might want to call it again later, which is implied by > EPROBE_DEFER. Maybe this should be EAGAIN instead? Just like > power-supply is doing in power_supply_get_property(). > Best regards, Krzysztof