Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp4997127pxb; Sun, 13 Feb 2022 04:16:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJypJEfN/RmzR+4X6+wcErtXVx24JdTd5zBJfkX8y62UgsyyJUSP4aCPbSuYVME7PMHNs53b X-Received: by 2002:a17:90a:a385:: with SMTP id x5mr9370107pjp.129.1644754585342; Sun, 13 Feb 2022 04:16:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644754585; cv=none; d=google.com; s=arc-20160816; b=m7m9JhcT/ODxGweDQelDo5h2+hbuAMfEZw4Kmg2qtjnVr78WuT52Ac7Js6WU/uSF8x s0Xk/63pBnLIOKFqo/b6503sgy/npV/mB1pc34vB9zSG5KOh3IZK7kwYSD8KvMEQu8E9 qFKSacRu35UvMiPpi90RMgfcLH5ZMGnrMW/JA6hx2Vk0GhKkwi4xUiLv8mpZR2pGI/AZ KGHKK63sS2mCMN6Es4O2py2S7zXY+KU/SzHhAZ2fZKvmE1Uf0yuUSHeWJwyGY30JaWJs BqUykG3z7zw3+kl1COcxnVjEyNQMbwUQ0GOj2pfY0BJ0RcmNmnw+Q3m3RNDAGJTUAAyF 1Fdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Au/mBqZaaQyBAGIOH8RzJibxV3VU/TZF+4arCyxvGTY=; b=Rcu4P0R4HqiL0O84q102ub6iidT6EqwVe/qjN1CqUn5nsZyiK4ewp9s1gMbg2kWsy5 8+GI5IYxE1TVtY6cff+nifUT3W8wu32U3HliJUEFsz4Y27m+rk8/hQDH+SBxbEgD7N2k q6+tV3nu//ntQIHdfpdElEGoZJWtHk6zp37jTME1EjrD2vFYbFAC6YSDShVwNk/E4GtE rvLur0xK/YJyi08DhIQ6QILMu17qaKZoTe/patE4WqPS/6iTj/k2OGF/uzvw4rQaOCmX fR886KhCGyGyLUnbnX+23k55ZwtLcEeUNOMxNXs0R2NVU6OR2aow1//v+mKsuaMBzl3C Wsjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KaOcepOd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ie5si8921824pjb.75.2022.02.13.04.15.49; Sun, 13 Feb 2022 04:16:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KaOcepOd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230304AbiBLSY0 (ORCPT + 99 others); Sat, 12 Feb 2022 13:24:26 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:47790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230337AbiBLSYA (ORCPT ); Sat, 12 Feb 2022 13:24:00 -0500 Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBE7C60076 for ; Sat, 12 Feb 2022 10:23:43 -0800 (PST) Received: by mail-pf1-x432.google.com with SMTP id i21so20485955pfd.13 for ; Sat, 12 Feb 2022 10:23:43 -0800 (PST) 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 :mime-version:content-transfer-encoding; bh=Au/mBqZaaQyBAGIOH8RzJibxV3VU/TZF+4arCyxvGTY=; b=KaOcepOdTQrhOR4AS8lQLqlzl7Q6jPb8Sp1fugWR2kck0NPwQOzIORI/gBTLGakR4r mta45Y/42w3HqwzwIkj6/ojghtSL2zLxZSBpfu9ehwvYwIpoTvRW9Tvpz3in4vnCEXkX etExvaeN8yYqmfniJum7ZrW+ExsK/EbPbwQaV/CTek6eZeKRGbPQVtdK+mYLrQBwiAet eXOKCOjgl+MtnfuOPNBYlWkoge4EMEZS7GG+887shkuPAZHEf9UZq+4UwPSAkY4WSZPo J4DJGVCOkVws3RtTh4QeGywhQzxrF7Fkm1qC38o8B6Zd71tcdeNXSX1v2y/8iE4QYkwF u0mA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Au/mBqZaaQyBAGIOH8RzJibxV3VU/TZF+4arCyxvGTY=; b=r1mETK5MCtY4Pl5bBix0NTPhVP15fVkbq9352yAxejKL2poA4VST1Dwo3TwgmCexhk +NymkkXW98NxuE7vIJW0yyzlmBlkKqFaCHrZWgGGXg7LNP5mTNNm6IFEWSKJR0ibZGPU YfZ8c3PrFDwZQhy0rYLHVzwch26YzTo56ohPqXOYQTWN9BQ+Ftv2X3BCk7n9GwBEERvS A1edKNKSEL+rkDQJsd3dx78q8+YPVVmHZ34ZhK6oiIPLHs4b+oFYNUCoarwVqgd2ta58 oT2xcAzATKxOO/GSpc4K/QQcSw09u42WJM/PqDSEHlKE2OfEP0PGTNxUHjGp8C7Z8pPp 45og== X-Gm-Message-State: AOAM531/W2VFaW2Q+LhNbjJ/SE/nnDiFsoehxfLXP6vlHa/G1Ks/blMX bwJo1FmvO0f32mg1EQ6yd/Yl X-Received: by 2002:a63:4903:: with SMTP id w3mr5749982pga.5.1644690222170; Sat, 12 Feb 2022 10:23:42 -0800 (PST) Received: from localhost.localdomain ([27.111.75.57]) by smtp.gmail.com with ESMTPSA id g12sm14961987pfj.148.2022.02.12.10.23.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Feb 2022 10:23:41 -0800 (PST) From: Manivannan Sadhasivam To: mhi@lists.linux.dev Cc: quic_hemantk@quicinc.com, quic_bbhatt@quicinc.com, quic_jhugo@quicinc.com, vinod.koul@linaro.org, bjorn.andersson@linaro.org, dmitry.baryshkov@linaro.org, quic_vbadigan@quicinc.com, quic_cang@quicinc.com, quic_skananth@quicinc.com, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, elder@linaro.org, Manivannan Sadhasivam Subject: [PATCH v3 25/25] bus: mhi: ep: Add uevent support for module autoloading Date: Sat, 12 Feb 2022 23:51:17 +0530 Message-Id: <20220212182117.49438-26-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220212182117.49438-1-manivannan.sadhasivam@linaro.org> References: <20220212182117.49438-1-manivannan.sadhasivam@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add uevent support to MHI endpoint bus so that the client drivers can be autoloaded by udev when the MHI endpoint devices gets created. The client drivers are expected to provide MODULE_DEVICE_TABLE with the MHI id_table struct so that the alias can be exported. The MHI endpoint reused the mhi_device_id structure of the MHI bus. Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/ep/main.c | 9 +++++++++ include/linux/mod_devicetable.h | 2 ++ scripts/mod/file2alias.c | 10 ++++++++++ 3 files changed, 21 insertions(+) diff --git a/drivers/bus/mhi/ep/main.c b/drivers/bus/mhi/ep/main.c index 315409705b91..8889382ee8d0 100644 --- a/drivers/bus/mhi/ep/main.c +++ b/drivers/bus/mhi/ep/main.c @@ -1546,6 +1546,14 @@ void mhi_ep_driver_unregister(struct mhi_ep_driver *mhi_drv) } EXPORT_SYMBOL_GPL(mhi_ep_driver_unregister); +static int mhi_ep_uevent(struct device *dev, struct kobj_uevent_env *env) +{ + struct mhi_ep_device *mhi_dev = to_mhi_ep_device(dev); + + return add_uevent_var(env, "MODALIAS=" MHI_EP_DEVICE_MODALIAS_FMT, + mhi_dev->name); +} + static int mhi_ep_match(struct device *dev, struct device_driver *drv) { struct mhi_ep_device *mhi_dev = to_mhi_ep_device(dev); @@ -1572,6 +1580,7 @@ struct bus_type mhi_ep_bus_type = { .name = "mhi_ep", .dev_name = "mhi_ep", .match = mhi_ep_match, + .uevent = mhi_ep_uevent, }; static int __init mhi_ep_init(void) diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index 4bb71979a8fd..0cff19bd72bf 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h @@ -835,6 +835,8 @@ struct wmi_device_id { #define MHI_DEVICE_MODALIAS_FMT "mhi:%s" #define MHI_NAME_SIZE 32 +#define MHI_EP_DEVICE_MODALIAS_FMT "mhi_ep:%s" + /** * struct mhi_device_id - MHI device identification * @chan: MHI channel name diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 5258247d78ac..d9d6a31446ea 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c @@ -1391,6 +1391,15 @@ static int do_mhi_entry(const char *filename, void *symval, char *alias) return 1; } +/* Looks like: mhi_ep:S */ +static int do_mhi_ep_entry(const char *filename, void *symval, char *alias) +{ + DEF_FIELD_ADDR(symval, mhi_device_id, chan); + sprintf(alias, MHI_EP_DEVICE_MODALIAS_FMT, *chan); + + return 1; +} + /* Looks like: ishtp:{guid} */ static int do_ishtp_entry(const char *filename, void *symval, char *alias) { @@ -1519,6 +1528,7 @@ static const struct devtable devtable[] = { {"tee", SIZE_tee_client_device_id, do_tee_entry}, {"wmi", SIZE_wmi_device_id, do_wmi_entry}, {"mhi", SIZE_mhi_device_id, do_mhi_entry}, + {"mhi_ep", SIZE_mhi_device_id, do_mhi_ep_entry}, {"auxiliary", SIZE_auxiliary_device_id, do_auxiliary_entry}, {"ssam", SIZE_ssam_device_id, do_ssam_entry}, {"dfl", SIZE_dfl_device_id, do_dfl_entry}, -- 2.25.1