From patchwork Thu Apr 30 19:05:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 11521271 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 328D081 for ; Thu, 30 Apr 2020 19:06:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1A74F2073E for ; Thu, 30 Apr 2020 19:06:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Sgo48uMd" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726571AbgD3TGO (ORCPT ); Thu, 30 Apr 2020 15:06:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726394AbgD3TGN (ORCPT ); Thu, 30 Apr 2020 15:06:13 -0400 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88DDDC035495 for ; Thu, 30 Apr 2020 12:06:12 -0700 (PDT) Received: by mail-pf1-x442.google.com with SMTP id r14so299582pfg.2 for ; Thu, 30 Apr 2020 12:06:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PYOJ3yLwIAGO30efCpTPWER9xTfitoIf/wwA38TChl8=; b=Sgo48uMdYecKrrgqgwTBEEN3gJutl3bCuqOzq7KuR/qnP+KWyRfVmi7zLQ5yqeoAkC KqwRimHiqEjCcNKN8Pr9bLn81TE0h2cpRd22UiT7V+1Q62UOkqJI1su87B/U1Vx16Dcd o0vhClWZY/Lzt2KUeVYPfdu+OIVLNaL3L2iwXD5dndzeUzPXDlDaiupZ+OpL0zqQTejb G9nQqhHbp1XF4jHO+btSCEITcapnG+p2mrhRTN1OfeLqOSx4dZLVFD6SAFMDfUmpipgw LQheJbwURBXnEW3f7c77aP501BU1LdEFKOSXVvywpyxjOn5pbvbk7jE4+7bqA1i183W+ d7KA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PYOJ3yLwIAGO30efCpTPWER9xTfitoIf/wwA38TChl8=; b=Uw4hgXerkvOLW2ZfDP6u6fREs/Om6kxfP9d8+L/Sk0RKoFJgOJLbtzh3HXHI9owTf7 xjTutFqW2OUOJ6CfRwhhKffj1xKN5DqHftpMiveVwW/+5kW4UgxARHEEG1w2NYO7pJWw 3cdAFyJSYCB03xoodPzcFmph23/rDX5MFKQB/ItsV7shm7kbwDIosCxmsBHzzFjQnEaf nkCngxhf6Sc0W2b/5NyEtWfTvqVZlTgEqimBObOkJP8Uh1R6dGODT/J/aXAPrk4m5mL6 ySg2XwwlloXdEjWbEkPpWXZwGHgzhI+0UQKmxXGl5peBLPTGrLbIso7lvKbuZ6L3KKtI T5NQ== X-Gm-Message-State: AGi0PubpN7XzsvmA+/7lvONYz/cge6tbezfnBgKXa3EvQ9V8OoX5p09z Y7cl//lKGFPhXUC60wUTWHv4iHRgh58l X-Google-Smtp-Source: APiQypLKBUFmbFTOo2CXOA/EFneBmv7DqfeIDYQfitIkisaTk6nfw7IXyPd1DrmCC9bPAPrvIOG8pw== X-Received: by 2002:aa7:864e:: with SMTP id a14mr192381pfo.67.1588273572011; Thu, 30 Apr 2020 12:06:12 -0700 (PDT) Received: from localhost.localdomain ([2409:4072:6081:946c:419e:a71:7237:1613]) by smtp.gmail.com with ESMTPSA id l37sm467863pje.12.2020.04.30.12.06.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2020 12:06:11 -0700 (PDT) From: Manivannan Sadhasivam To: gregkh@linuxfoundation.org Cc: hemantk@codeaurora.org, jhugo@codeaurora.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Manivannan Sadhasivam Subject: [PATCH 1/6] bus: mhi: Fix parsing of mhi_flags Date: Fri, 1 May 2020 00:35:50 +0530 Message-Id: <20200430190555.32741-2-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200430190555.32741-1-manivannan.sadhasivam@linaro.org> References: <20200430190555.32741-1-manivannan.sadhasivam@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org With the current parsing of mhi_flags, the following statement always return false: eob = !!(flags & MHI_EOB); This is due to the fact that 'enum mhi_flags' starts with index 0 and we are using direct AND operation to extract each bit. Fix this by using BIT() macros for defining the flags so that the reset of the code need not be touched. Fixes: 189ff97cca53 ("bus: mhi: core: Add support for data transfer") Reported-by: Dan Carpenter Signed-off-by: Manivannan Sadhasivam --- include/linux/mhi.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/linux/mhi.h b/include/linux/mhi.h index a4288f4d656f..3e76dc9cba5d 100644 --- a/include/linux/mhi.h +++ b/include/linux/mhi.h @@ -53,9 +53,9 @@ enum mhi_callback { * @MHI_CHAIN: Linked transfer */ enum mhi_flags { - MHI_EOB, - MHI_EOT, - MHI_CHAIN, + MHI_EOB = BIT(0), + MHI_EOT = BIT(1), + MHI_CHAIN = BIT(2), }; /** From patchwork Thu Apr 30 19:05:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 11521273 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D7241912 for ; Thu, 30 Apr 2020 19:06:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BE5EC2054F for ; Thu, 30 Apr 2020 19:06:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="pGfETTCU" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726565AbgD3TGT (ORCPT ); Thu, 30 Apr 2020 15:06:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726712AbgD3TGR (ORCPT ); Thu, 30 Apr 2020 15:06:17 -0400 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2041FC035495 for ; Thu, 30 Apr 2020 12:06:16 -0700 (PDT) Received: by mail-pf1-x443.google.com with SMTP id 145so271047pfw.13 for ; Thu, 30 Apr 2020 12:06:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=zx0E+HqaN1bUC1TO1dtOQ7VQXn9VN+e8/WjHREoxvcw=; b=pGfETTCUGJ1eplG30Gh134q0RJpVt2LEqKse+6q9W9S31dTzgSwHfioljRBmVjtup6 K+Z9SU8M2FodJMg1JhhKs18gVO4xC1z+Vo79wh/+K9RYUoH5cd3LKWKw09QWmvhjC6Z/ K5/OUPMjTqydRKN53yusuaggvVJ0gVZgjzvt5UyKdz0upTJplIJYPUP6jpcllIvFOJ4J q3FazBste8FZQJvxSc6zCQwN/jHQfqP39vgbHdMxz4mdj3GNnhFWB5qqLCcul8nAY8sZ 1gr+7UfyZ8T4lEaM/hPDv9tl1KY5MBoBJz8ISvTBM5x/TpdgtTwUKjHT9qIRfAm6+ya6 DEiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=zx0E+HqaN1bUC1TO1dtOQ7VQXn9VN+e8/WjHREoxvcw=; b=Zpg22y+/VpHyRwVocwRMTVKrFgDZK2R0QpTdFjaF1Y1aePSN1PUWJOmTj0aRLMU8n/ qvjYPUvESmY79M8n+CSJa08m6ldA0gHgJMSicpAOyPvze4M9GAwHZh7f4zAAADe2uEny UmBgAgIgmSbz07ZvK8gRKFYrhBciaWzpBKYybimPlJjg5NObHrCFKHLS6NNFmqQfJmCO 5HpV9DmbgYi8s8dzaJ6/MtcA3NmOOSM5Hd0KUqNttlazfBxqFe2bGpNTmsytBUgmR1zo 27PPy3o4oza6n/xgWGECV8/YQ/SYPEMK7Tszh2cd3ac35Lz810jU8T0/jNRWfZoCBcjQ CpcQ== X-Gm-Message-State: AGi0PuaFReoD9Rod9xdD7fnqg78CrURlE4JiUe1ltxIs7+xS/LgNL/ri Cvv3hsLPnQWCthUtZ+YxIcm6 X-Google-Smtp-Source: APiQypIz7M4XRoff71ERL1h7ZhbbJwJXnruE5yMtB50LeY3NFYKPbTHrJ6OexVFO51GAQqylNa670Q== X-Received: by 2002:a63:de49:: with SMTP id y9mr349872pgi.435.1588273575577; Thu, 30 Apr 2020 12:06:15 -0700 (PDT) Received: from localhost.localdomain ([2409:4072:6081:946c:419e:a71:7237:1613]) by smtp.gmail.com with ESMTPSA id l37sm467863pje.12.2020.04.30.12.06.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2020 12:06:15 -0700 (PDT) From: Manivannan Sadhasivam To: gregkh@linuxfoundation.org Cc: hemantk@codeaurora.org, jhugo@codeaurora.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Manivannan Sadhasivam Subject: [PATCH 2/6] bus: mhi: core: Make sure to powerdown if mhi_sync_power_up fails Date: Fri, 1 May 2020 00:35:51 +0530 Message-Id: <20200430190555.32741-3-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200430190555.32741-1-manivannan.sadhasivam@linaro.org> References: <20200430190555.32741-1-manivannan.sadhasivam@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Jeffrey Hugo Powerdown is necessary if mhi_sync_power_up fails due to a timeout, to clean up the resources. Otherwise a BUG could be triggered when attempting to clean up MSIs because the IRQ is still active from a request_irq(). Signed-off-by: Jeffrey Hugo Reviewed-by: Hemant Kumar Reviewed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/pm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c index 3529419d076b..e7c831867a23 100644 --- a/drivers/bus/mhi/core/pm.c +++ b/drivers/bus/mhi/core/pm.c @@ -1045,7 +1045,11 @@ int mhi_sync_power_up(struct mhi_controller *mhi_cntrl) MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state), msecs_to_jiffies(mhi_cntrl->timeout_ms)); - return (MHI_IN_MISSION_MODE(mhi_cntrl->ee)) ? 0 : -EIO; + ret = (MHI_IN_MISSION_MODE(mhi_cntrl->ee)) ? 0 : -ETIMEDOUT; + if (ret) + mhi_power_down(mhi_cntrl, false); + + return ret; } EXPORT_SYMBOL(mhi_sync_power_up); From patchwork Thu Apr 30 19:05:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 11521275 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 13C7C81 for ; Thu, 30 Apr 2020 19:06:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F003E2054F for ; Thu, 30 Apr 2020 19:06:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="HUmhodjJ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726766AbgD3TGV (ORCPT ); Thu, 30 Apr 2020 15:06:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726757AbgD3TGV (ORCPT ); Thu, 30 Apr 2020 15:06:21 -0400 Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6EF7C035495 for ; Thu, 30 Apr 2020 12:06:19 -0700 (PDT) Received: by mail-pj1-x1041.google.com with SMTP id a32so1166041pje.5 for ; Thu, 30 Apr 2020 12:06:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=HqOW945RKza/JpsluftGvHrtnYoUZM59Kb7ny0dAINI=; b=HUmhodjJnkMQH959dPU/FHOgOs2RkforQQ0szf496o+WX6SXYZ4txDutrlJ09paeEp YnGrVxpyc9xN/RvDelHq5cnG+E5Qylju4uuR54oABDtxzQWRjrhIjB7uA2/YzKgTO2NF 8q9gyK959A+0hmvuF/3G23aiz64pcm7snO5OKlLmXIWUm4i2y3rzcv+gKeAsisc35Zwe rFSVEwpl6IfoY3uEATOFabKnKC3GfqNUhFO6CnUobxWBKcvWri7GG7VdR3Iv0fdMVThD zf5MVpvxjIORR8qdHVS2pxNxojLobHj+LaZwc7Uzp9zEEUOHV1yloBTM5H1no6QO6BBS Itsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=HqOW945RKza/JpsluftGvHrtnYoUZM59Kb7ny0dAINI=; b=SqIHmYvAjG7gWxnFmdRTYtfbYznYugcEFQyHucUSJTMkDWanNeJo/w2m7UEIeNVzkL vQoGJbPZIwcjzwAD+wBGi95cEf99wSzFtJweLGl9Ggd351CvVOByNUDh/dqLh8qODtPY xySlsby6rLSapmHA1vUKm9OPcq8Jzhw66EI/m5l4pEViwfW8bTlYlyxH4KBos72flZK4 rhsaGkf5j/Qxcam08oRVDwGHxN29TRiTj4qdudZmjrWRfBRm0MAFpDfJ4Tu5jn124Ek4 fBQhhROpSDjdaasAedKxCRn4L2HqIJz0ggmGbWWHu2dVcZNP/a4zlwSIQJhQ0zq/isLh APfw== X-Gm-Message-State: AGi0Puacp0Dn4rLX6jxJkQlgb/QHESW9XSURVQDP2kyrxQcN6/p1TjRm PAxyT8yM2Fs5BBnh2NrmIj/N X-Google-Smtp-Source: APiQypIoz9U4YuvrxFQ8f8sIIRfoCejZKyaTDPp9ytCz1Crot+vzDnqAgJj+U7x/JkSmrd7ZTxNQyw== X-Received: by 2002:a17:902:b948:: with SMTP id h8mr414798pls.309.1588273579341; Thu, 30 Apr 2020 12:06:19 -0700 (PDT) Received: from localhost.localdomain ([2409:4072:6081:946c:419e:a71:7237:1613]) by smtp.gmail.com with ESMTPSA id l37sm467863pje.12.2020.04.30.12.06.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2020 12:06:18 -0700 (PDT) From: Manivannan Sadhasivam To: gregkh@linuxfoundation.org Cc: hemantk@codeaurora.org, jhugo@codeaurora.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Manivannan Sadhasivam Subject: [PATCH 3/6] bus: mhi: core: Remove link_status() callback Date: Fri, 1 May 2020 00:35:52 +0530 Message-Id: <20200430190555.32741-4-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200430190555.32741-1-manivannan.sadhasivam@linaro.org> References: <20200430190555.32741-1-manivannan.sadhasivam@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Jeffrey Hugo If the MHI core detects invalid data due to a PCI read, it calls into the controller via link_status() to double check that the link is infact down. All in all, this is pretty pointless, and racy. There are no good reasons for this, and only drawbacks. Its pointless because chances are, the controller is going to do the same thing to determine if the link is down - attempt a PCI access and compare the result. This does not make the link status decision any smarter. Its racy because its possible that the link was down at the time of the MHI core access, but then recovered before the controller access. In this case, the controller will indicate the link is not down, and the MHI core will precede to use a bad value as the MHI core does not attempt to retry the access. Retrying the access in the MHI core is a bad idea because again, it is racy - what if the link is down again? Furthermore, there may be some higher level state associated with the link status, that is now invalid because the link went down. The only reason why the MHI core could see "invalid" data when doing a PCI access, that is actually valid, is if the register actually contained the PCI spec defined sentinel for an invalid access. In this case, it is arguable that the MHI implementation broken, and should be fixed, not worked around. Therefore, remove the link_status() callback before anyone attempts to implement it. Signed-off-by: Jeffrey Hugo Reviewed-by: Manivannan Sadhasivam Reviewed-by: Hemant Kumar Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/init.c | 6 ++---- drivers/bus/mhi/core/main.c | 5 ++--- include/linux/mhi.h | 2 -- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c index b38359c480ea..2af08d57ec28 100644 --- a/drivers/bus/mhi/core/init.c +++ b/drivers/bus/mhi/core/init.c @@ -812,10 +812,8 @@ int mhi_register_controller(struct mhi_controller *mhi_cntrl, if (!mhi_cntrl) return -EINVAL; - if (!mhi_cntrl->runtime_get || !mhi_cntrl->runtime_put) - return -EINVAL; - - if (!mhi_cntrl->status_cb || !mhi_cntrl->link_status) + if (!mhi_cntrl->runtime_get || !mhi_cntrl->runtime_put || + !mhi_cntrl->status_cb) return -EINVAL; ret = parse_config(mhi_cntrl, config); diff --git a/drivers/bus/mhi/core/main.c b/drivers/bus/mhi/core/main.c index 3e9aa3b2da77..374e3db31ab7 100644 --- a/drivers/bus/mhi/core/main.c +++ b/drivers/bus/mhi/core/main.c @@ -20,9 +20,8 @@ int __must_check mhi_read_reg(struct mhi_controller *mhi_cntrl, { u32 tmp = readl(base + offset); - /* If there is any unexpected value, query the link status */ - if (PCI_INVALID_READ(tmp) && - mhi_cntrl->link_status(mhi_cntrl)) + /* If the value is invalid, the link is down */ + if (PCI_INVALID_READ(tmp)) return -EIO; *out = tmp; diff --git a/include/linux/mhi.h b/include/linux/mhi.h index 3e76dc9cba5d..0794483b9a18 100644 --- a/include/linux/mhi.h +++ b/include/linux/mhi.h @@ -335,7 +335,6 @@ struct mhi_controller_config { * @syserr_worker: System error worker * @state_event: State change event * @status_cb: CB function to notify power states of the device (required) - * @link_status: CB function to query link status of the device (required) * @wake_get: CB function to assert device wake (optional) * @wake_put: CB function to de-assert device wake (optional) * @wake_toggle: CB function to assert and de-assert device wake (optional) @@ -417,7 +416,6 @@ struct mhi_controller { void (*status_cb)(struct mhi_controller *mhi_cntrl, enum mhi_callback cb); - int (*link_status)(struct mhi_controller *mhi_cntrl); void (*wake_get)(struct mhi_controller *mhi_cntrl, bool override); void (*wake_put)(struct mhi_controller *mhi_cntrl, bool override); void (*wake_toggle)(struct mhi_controller *mhi_cntrl); From patchwork Thu Apr 30 19:05:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 11521281 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A741381 for ; Thu, 30 Apr 2020 19:06:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8F55B2073E for ; Thu, 30 Apr 2020 19:06:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="uZm85oNN" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726787AbgD3TGY (ORCPT ); Thu, 30 Apr 2020 15:06:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726777AbgD3TGY (ORCPT ); Thu, 30 Apr 2020 15:06:24 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0943DC035495 for ; Thu, 30 Apr 2020 12:06:24 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id hi11so1168434pjb.3 for ; Thu, 30 Apr 2020 12:06:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PUPDbypIxhh2WVCFx2ZlZOTBGGgSTEvz8TM+sHkk8P4=; b=uZm85oNNlhOH74T3gDaMkTUyTfNQ+mnP2aok4Zpkvjz9Yff6NI7kpdgRr+20Fdd+os kfc3S/8fb6vzd4kK0ogsPDYj0KebnSA9nSOYZSySv+cU7ZiaVgpbP4X7H2/m6pWtsb0s 0v+H4yjgMTR35CNcvZJBiB5jDUbE0upcs4pTU1kY8Svo1X/QYNIHik92GSX9iwI+XwOi gtmJFdTmO5auycgfmxvxmLZoMUAl9t3ljLBlZa/UBliRdHroyukXuUdABjj3yLTkUT/3 GRiI2IR+S3Ozvb74YC0VoPnDneJlf8ZGfrKRBeeHdtOJvyhNgBzqM8XfB0UWrnzmnb2j H0zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PUPDbypIxhh2WVCFx2ZlZOTBGGgSTEvz8TM+sHkk8P4=; b=A0X3f1/c3Si+QFQ5UqoaoNm+L0AkXxmOa6npDtDExg97ACcmi0ogYPb2g4zLSAiTGN OH6HxadYGONvjvfXo6NOAPPQdjDaVdgJGocQPRNRZ8RM15JohxSeTeAvgdAk8XhyttCI 8ziRLjAuOo/WdQrtNxLxNHs63wsYDCowoYRoWFSXOqvl2Ig/rnoAhDnZv3Uu4zG5gS1+ GYNIQrmT0/EWNCBdqzfqRtckD1H/VN0qELrXSpwzrI6ELby2PzykX5vm9SIwN2HTrsZm 5dTInCILzVaYjUfxxOTkfS6+GyWsRU+2GjwiiCoAJ2VObkG+YPbZxQFetMUuF1VAJdFs XrUQ== X-Gm-Message-State: AGi0PuYoFfycQC8SMeA1LQj5zmoV4U5BFC/kqmtctMgCN3EYeuPxvxA5 nU2dGdAp2c39GPeWbaLOT57N X-Google-Smtp-Source: APiQypJzuYqCCAVTxGBbPMUUxm6BAcisq+u16Nx2Rfw5SL7UcM60s7mUaT1d0UHi6iRnOK8vkFmmGA== X-Received: by 2002:a17:90a:eb05:: with SMTP id j5mr291007pjz.86.1588273583431; Thu, 30 Apr 2020 12:06:23 -0700 (PDT) Received: from localhost.localdomain ([2409:4072:6081:946c:419e:a71:7237:1613]) by smtp.gmail.com with ESMTPSA id l37sm467863pje.12.2020.04.30.12.06.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2020 12:06:22 -0700 (PDT) From: Manivannan Sadhasivam To: gregkh@linuxfoundation.org Cc: hemantk@codeaurora.org, jhugo@codeaurora.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Manivannan Sadhasivam Subject: [PATCH 4/6] bus: mhi: core: Offload register accesses to the controller Date: Fri, 1 May 2020 00:35:53 +0530 Message-Id: <20200430190555.32741-5-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200430190555.32741-1-manivannan.sadhasivam@linaro.org> References: <20200430190555.32741-1-manivannan.sadhasivam@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Jeffrey Hugo When reading or writing MHI registers, the core assumes that the physical link is a memory mapped PCI link. This assumption may not hold for all MHI devices. The controller knows what is the physical link (ie PCI, I2C, SPI, etc), and therefore knows the proper methods to access that link. The controller can also handle link specific error scenarios, such as reading -1 when the PCI link went down. Therefore, it is appropriate that the MHI core requests the controller to make register accesses on behalf of the core, which abstracts the core from link specifics, and end up removing an unnecessary assumption. Signed-off-by: Jeffrey Hugo Reviewed-by: Hemant Kumar Reviewed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/init.c | 3 ++- drivers/bus/mhi/core/internal.h | 3 --- drivers/bus/mhi/core/main.c | 12 ++---------- include/linux/mhi.h | 6 ++++++ 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c index 2af08d57ec28..eb2ab058a01d 100644 --- a/drivers/bus/mhi/core/init.c +++ b/drivers/bus/mhi/core/init.c @@ -813,7 +813,8 @@ int mhi_register_controller(struct mhi_controller *mhi_cntrl, return -EINVAL; if (!mhi_cntrl->runtime_get || !mhi_cntrl->runtime_put || - !mhi_cntrl->status_cb) + !mhi_cntrl->status_cb || !mhi_cntrl->read_reg || + !mhi_cntrl->write_reg) return -EINVAL; ret = parse_config(mhi_cntrl, config); diff --git a/drivers/bus/mhi/core/internal.h b/drivers/bus/mhi/core/internal.h index 5deadfaa053a..095d95bc0e37 100644 --- a/drivers/bus/mhi/core/internal.h +++ b/drivers/bus/mhi/core/internal.h @@ -11,9 +11,6 @@ extern struct bus_type mhi_bus_type; -/* MHI MMIO register mapping */ -#define PCI_INVALID_READ(val) (val == U32_MAX) - #define MHIREGLEN (0x0) #define MHIREGLEN_MHIREGLEN_MASK (0xFFFFFFFF) #define MHIREGLEN_MHIREGLEN_SHIFT (0) diff --git a/drivers/bus/mhi/core/main.c b/drivers/bus/mhi/core/main.c index 374e3db31ab7..0cc85753d9d6 100644 --- a/drivers/bus/mhi/core/main.c +++ b/drivers/bus/mhi/core/main.c @@ -18,15 +18,7 @@ int __must_check mhi_read_reg(struct mhi_controller *mhi_cntrl, void __iomem *base, u32 offset, u32 *out) { - u32 tmp = readl(base + offset); - - /* If the value is invalid, the link is down */ - if (PCI_INVALID_READ(tmp)) - return -EIO; - - *out = tmp; - - return 0; + return mhi_cntrl->read_reg(mhi_cntrl, base + offset, out); } int __must_check mhi_read_reg_field(struct mhi_controller *mhi_cntrl, @@ -48,7 +40,7 @@ int __must_check mhi_read_reg_field(struct mhi_controller *mhi_cntrl, void mhi_write_reg(struct mhi_controller *mhi_cntrl, void __iomem *base, u32 offset, u32 val) { - writel(val, base + offset); + mhi_cntrl->write_reg(mhi_cntrl, base + offset, val); } void mhi_write_reg_field(struct mhi_controller *mhi_cntrl, void __iomem *base, diff --git a/include/linux/mhi.h b/include/linux/mhi.h index 0794483b9a18..ab737821ab89 100644 --- a/include/linux/mhi.h +++ b/include/linux/mhi.h @@ -342,6 +342,8 @@ struct mhi_controller_config { * @runtimet_put: CB function to decrement pm usage (required) * @map_single: CB function to create TRE buffer * @unmap_single: CB function to destroy TRE buffer + * @read_reg: Read a MHI register via the physical link (required) + * @write_reg: Write a MHI register via the physical link (required) * @buffer_len: Bounce buffer length * @bounce_buf: Use of bounce buffer * @fbc_download: MHI host needs to do complete image transfer (optional) @@ -425,6 +427,10 @@ struct mhi_controller { struct mhi_buf_info *buf); void (*unmap_single)(struct mhi_controller *mhi_cntrl, struct mhi_buf_info *buf); + int (*read_reg)(struct mhi_controller *mhi_cntrl, void __iomem *addr, + u32 *out); + void (*write_reg)(struct mhi_controller *mhi_cntrl, void __iomem *addr, + u32 val); size_t buffer_len; bool bounce_buf; From patchwork Thu Apr 30 19:05:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 11521277 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0F78C81 for ; Thu, 30 Apr 2020 19:06:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E95522054F for ; Thu, 30 Apr 2020 19:06:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="LLV3k+K1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726781AbgD3TG3 (ORCPT ); Thu, 30 Apr 2020 15:06:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726853AbgD3TG2 (ORCPT ); Thu, 30 Apr 2020 15:06:28 -0400 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F86FC035495 for ; Thu, 30 Apr 2020 12:06:28 -0700 (PDT) Received: by mail-pl1-x644.google.com with SMTP id s20so2623400plp.6 for ; Thu, 30 Apr 2020 12:06:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=w/e0sFCiHkWZ/pUleIEQQ5eNFFg5ce0+O2BEm35hI8k=; b=LLV3k+K1eDs0cMEs1NnGL6zPog74yxpY0C4JeWKzjsCoNXNxulXybWhvjyN55chFUo wi3sCflCYn3OhE4vXu3EB8fyCwNc4p52wmk1C6lEA8zVhYcrHoi3We7yaauVs1vEbsIi kOpZQ2nnQ+yynjxwp/khhaS7E5cSzN40/wHVFqEQ4n6zIKBmZVhh3ErfdvD1DML71Yzp 219K5we5WrlFEcPl5pWWkNxCWeHmd0SV33UfSXD/9DRO4VDgIP/M3PLFB1rlxU6V8R0S 5pE1t1MqxTqVcdBZ20UZdusc6kg6Gbe+Ix+bPdbUP/4RmdVqmchuTmmiNCULQBP7uMqw q7Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=w/e0sFCiHkWZ/pUleIEQQ5eNFFg5ce0+O2BEm35hI8k=; b=NqdrJXQRwj7Uvv3wic26CvdfT3j/EXtyhHChfuwjXC5utowE8W/AyE8Z1IWblOkBD3 7hU6J/bLSml+u+BUuPnwSYri1KlbcgGekv6wVcUYzuJsEXB8u5JclmCREB1ZOYEaGX68 zyylJngoRWiZIWHKO4R5vA8zLVuY6bc50QMvodygTkDl7oSZU3GADkcsxMDVoQWkp1Au 5PIA3p4aB9RGmk7oh7S3y+Zr9pqVeF7t0z6U48Ng8MPOEEVolfXysFnVRU4GfPan7smB e2P/uQsEtV7McBW1vj6NbH0xUhz+bLU0BHnlS2e3GXj71rvlRdNoMR+6VRn9B6CZAxna sOig== X-Gm-Message-State: AGi0PuaWMPZUJzTIqsz2BmdM8VEg2E856io2FBhenkzTVEgJUtKGfUC+ iWeXVJgI2S63ZlW9UYHcHah+/jDoDmQj X-Google-Smtp-Source: APiQypJJVO0xLYp3ha4tq6wbudCY/3MtMc9vE/hG79BqTGCNQMI2rJf4+vTlq9vmCx3imNXrw26+fw== X-Received: by 2002:a17:90a:37c4:: with SMTP id v62mr233665pjb.177.1588273587530; Thu, 30 Apr 2020 12:06:27 -0700 (PDT) Received: from localhost.localdomain ([2409:4072:6081:946c:419e:a71:7237:1613]) by smtp.gmail.com with ESMTPSA id l37sm467863pje.12.2020.04.30.12.06.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2020 12:06:26 -0700 (PDT) From: Manivannan Sadhasivam To: gregkh@linuxfoundation.org Cc: hemantk@codeaurora.org, jhugo@codeaurora.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Manivannan Sadhasivam Subject: [PATCH 5/6] bus: mhi: core: Fix typo in comment Date: Fri, 1 May 2020 00:35:54 +0530 Message-Id: <20200430190555.32741-6-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200430190555.32741-1-manivannan.sadhasivam@linaro.org> References: <20200430190555.32741-1-manivannan.sadhasivam@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Jeffrey Hugo There is a typo - "runtimet" should be "runtime". Fix it. Signed-off-by: Jeffrey Hugo Reviewed-by: Hemant Kumar Reviewed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam --- include/linux/mhi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/mhi.h b/include/linux/mhi.h index ab737821ab89..b0739ad1bae4 100644 --- a/include/linux/mhi.h +++ b/include/linux/mhi.h @@ -339,7 +339,7 @@ struct mhi_controller_config { * @wake_put: CB function to de-assert device wake (optional) * @wake_toggle: CB function to assert and de-assert device wake (optional) * @runtime_get: CB function to controller runtime resume (required) - * @runtimet_put: CB function to decrement pm usage (required) + * @runtime_put: CB function to decrement pm usage (required) * @map_single: CB function to create TRE buffer * @unmap_single: CB function to destroy TRE buffer * @read_reg: Read a MHI register via the physical link (required) From patchwork Thu Apr 30 19:05:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 11521279 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7684081 for ; Thu, 30 Apr 2020 19:06:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5F6B820836 for ; Thu, 30 Apr 2020 19:06:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="uVyX6ILd" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726885AbgD3TGd (ORCPT ); Thu, 30 Apr 2020 15:06:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726881AbgD3TGc (ORCPT ); Thu, 30 Apr 2020 15:06:32 -0400 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AAA5C035495 for ; Thu, 30 Apr 2020 12:06:32 -0700 (PDT) Received: by mail-pf1-x442.google.com with SMTP id r14so300073pfg.2 for ; Thu, 30 Apr 2020 12:06:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=O52djhHmK7M4A1HwqhvSw4on/9rW+xT0L0CMrNKNv+Q=; b=uVyX6ILdRfLa0H+KKEgcl6KCnHmDJU5kzmBnzbsjwHj/7OMc1KbtkUtmXddsoi7PRb M+qulLDqixLc54j/1OPPKUJHlsiBrrpkvkPhZk/vKaX4m4woL8B3/r4ssSaEKKbrmSA/ 7yiRUdpfXGS2hOn7Vv2jSpsMy1CPr54fHuMYT/VaEMkOU0WiOmKOgczMn6cQb6ZcVcAh 2ekaHG/w4zFkz3GQ47zNCHXj7NAwR0jOUMDOFlLMy0fsUXSY1DjERDFwNrZjX4p/5PPM HaiopqEICpMjcIsRYsZtrWZMFYgW17Fwi5m/Sq6MjeUZIqVJ3KV+SUkSrdOq1ilME+Yu x27g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=O52djhHmK7M4A1HwqhvSw4on/9rW+xT0L0CMrNKNv+Q=; b=aaIEoMCgE8a6F3pK8GfA9LLQuu6xa+026q+NdHCC2S6hSmqgq5ul3OhRKiaRFqzU5q czqKV00czDgPGocquB7uY7Jc9TeGIQk3B1lk3Uq2ycjWcHTTgaoUJOxBTUuzJ35ovtS+ PCOJz0UYLy0hKP/CIOWPoUT3m0/uzFNAL+ITnyUk71mBD9Mg1cA5Y3JBd8sfIzFWcb0h aC841NyrFlXcTnw6oS2kBFPoK7V2uJ2dymvOhBbIavWAl7K2tJ9dcN+wtj5C0fMN6s/T CsqEZbeVIFTn8ud8fRM8CWB0PnZiTz+eKTFcE4e9C6ni9xNvc8QjURgHSxLj16DODYBz /Yog== X-Gm-Message-State: AGi0Pub6uWw/fWSe3lckcRcgC0q4mnbN5KQYHSpP0aa0uUs+7OayipMU ap9jptMnIkQEp0Ydp3ZMY0YA X-Google-Smtp-Source: APiQypItt/3A0S35o798IOq0uO8f+IKlszzegenfSsXsflkF2hdpzUZkwGUuKDYX7hMxX+thiQQ6hw== X-Received: by 2002:a63:b649:: with SMTP id v9mr358899pgt.402.1588273591813; Thu, 30 Apr 2020 12:06:31 -0700 (PDT) Received: from localhost.localdomain ([2409:4072:6081:946c:419e:a71:7237:1613]) by smtp.gmail.com with ESMTPSA id l37sm467863pje.12.2020.04.30.12.06.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2020 12:06:31 -0700 (PDT) From: Manivannan Sadhasivam To: gregkh@linuxfoundation.org Cc: hemantk@codeaurora.org, jhugo@codeaurora.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Manivannan Sadhasivam Subject: [PATCH 6/6] bus: mhi: core: Fix channel device name conflict Date: Fri, 1 May 2020 00:35:55 +0530 Message-Id: <20200430190555.32741-7-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200430190555.32741-1-manivannan.sadhasivam@linaro.org> References: <20200430190555.32741-1-manivannan.sadhasivam@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Jeffrey Hugo When multiple instances of the same MHI product are present in a system, we can see a splat from mhi_create_devices() - "sysfs: cannot create duplicate filename". This is because the device names assigned to the MHI channel devices are non-unique. They consist of the channel's name, and the channel's pipe id. For identical products, each instance is going to have the same set of channel (both in name and pipe id). To fix this, we prepend the device name of the parent device that the MHI channels belong to. Since different instances of the same product should have unique device names, this makes the MHI channel devices for each product also unique. Additionally, remove the pipe id from the MHI channel device name. This is an internal detail to the MHI product that provides little value, and imposes too much device specific internal details to userspace. It is expected that channel with a specific name (ie "SAHARA") has a specific client, and it does not matter what pipe id that channel is enumerated on. The pipe id is an internal detail between the MHI bus, and the hardware. The client is not expected to make decisions based on the pipe id, and to do so would require the client to have intimate knowledge of the hardware, which is inappropiate as it may violate the layering provided by the MHI bus. The limitation of doing this is that each product may only have one instance of a channel by a unique name. This limitation is appropriate given the usecases of MHI channels. Signed-off-by: Jeffrey Hugo Reviewed-by: Hemant Kumar Reviewed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/bus/mhi/core/main.c b/drivers/bus/mhi/core/main.c index 0cc85753d9d6..a8b5c4846e1c 100644 --- a/drivers/bus/mhi/core/main.c +++ b/drivers/bus/mhi/core/main.c @@ -328,7 +328,8 @@ void mhi_create_devices(struct mhi_controller *mhi_cntrl) /* Channel name is same for both UL and DL */ mhi_dev->chan_name = mhi_chan->name; - dev_set_name(&mhi_dev->dev, "%04x_%s", mhi_chan->chan, + dev_set_name(&mhi_dev->dev, "%s_%s", + dev_name(mhi_cntrl->cntrl_dev), mhi_dev->chan_name); /* Init wakeup source if available */