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: 189350 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 334D2C47247 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 14BF62054F 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: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: 189349 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17AF0C4724C 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 F0921207DD 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: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: 189348 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C9A3C4724C 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 5E52C2073E 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 */