bus: mhi: core: Check for IRQ availability during registration
authorBhaumik Bhatt <bbhatt@codeaurora.org>
Mon, 9 Nov 2020 20:47:28 +0000 (12:47 -0800)
committerManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Wed, 18 Nov 2020 09:50:34 +0000 (15:20 +0530)
Current design allows a controller to register with MHI successfully
without the need to have any IRQs available for use. If no IRQs are
available, power up requests to MHI can fail after a successful
registration with MHI. Improve the design by checking for the number
of IRQs available sooner within the mhi_regsiter_controller() API as
it is required to be specified by the controller.

Signed-off-by: Bhaumik Bhatt <bbhatt@codeaurora.org>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
drivers/bus/mhi/core/init.c
drivers/bus/mhi/core/pm.c

index 877e40c86801a7b954d502187e7c9a617ba68588..2534f1c9c15381138f1d9796dd44cc1fafd79fa5 100644 (file)
@@ -858,7 +858,7 @@ int mhi_register_controller(struct mhi_controller *mhi_cntrl,
 
        if (!mhi_cntrl->runtime_get || !mhi_cntrl->runtime_put ||
            !mhi_cntrl->status_cb || !mhi_cntrl->read_reg ||
-           !mhi_cntrl->write_reg)
+           !mhi_cntrl->write_reg || !mhi_cntrl->nr_irqs)
                return -EINVAL;
 
        ret = parse_config(mhi_cntrl, config);
index 06adea2580d264c876d4e39790f9df8fcdfbfc67..1d04e401b67f90396c70a29361692fdfcd7d0e03 100644 (file)
@@ -926,9 +926,6 @@ int mhi_async_power_up(struct mhi_controller *mhi_cntrl)
 
        dev_info(dev, "Requested to power ON\n");
 
-       if (mhi_cntrl->nr_irqs < 1)
-               return -EINVAL;
-
        /* Supply default wake routines if not provided by controller driver */
        if (!mhi_cntrl->wake_get || !mhi_cntrl->wake_put ||
            !mhi_cntrl->wake_toggle) {