From patchwork Tue Oct 17 20:05:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 13425957 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D060DCDB474 for ; Tue, 17 Oct 2023 20:06:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=TgB6W7tMHSTbacBFCgASpd0E/R2mKByKKW2qLy+zNlg=; b=TqwebflR4RsxAa Ytv3rPYJEVVmjyNJQ+TZXa9YQMxLvREbl2W1OXsob1gAoCsePg/eytr0G9l+8Vl5Ab7Il5Ap77NGB uJ6R1Qxi3hdqdxouSrUyhSh7xTiGnalWJCVifjiOnGGl1FD8ZGGMKDn7woGc882HTMtWDSpDWLAwx cdbNOzyuviY629bKok+X2hbb1yHZHrCDV6ddux+ki72OAcfcMULrLmwR4fszYd0n+eFTA/7+tfalA TEmCKFqU713CRhlC1JUqkMowPG35fFQ0c+p4KFqbFiTQwHHRpaFq/UT1Q50XHrLGlJv7OlTjlZwNh zgjdpPotTujebGlGzUHQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qsqJr-00DAFe-1k; Tue, 17 Oct 2023 20:05:35 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qsqJn-00DAE5-25; Tue, 17 Oct 2023 20:05:33 +0000 Received: from umang.jainideasonboard.com (unknown [103.251.226.39]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id B5F92327; Tue, 17 Oct 2023 22:05:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1697573121; bh=iQUiruD5/axO9qzXMiXGdAfCw49ZKlu1tk/e62H4f3k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TSYk0vj48Sn4OYrjoN9r/1ZfhlvDn0HJE/8xxSvZ6QAdBMJI0pcwsMYl8DCCBJLVx pPElnuG4Sa510MCPUJxOMspnFff/08g61JxVUuxsdea9HP5vfhP0qF7/CBQBfcuCib Ryr3Gdtr3R9tyu6twnnCaQUeZ2skWdh7rqLmkh3Y= From: Umang Jain To: linux-staging@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-rpi-kernel@lists.infradead.org, linux-media@vger.kernel.org Cc: Stefan Wahren , Greg Kroah-Hartman , Dan Carpenter , Kieran Bingham , Laurent Pinchart , Umang Jain Subject: [PATCH 1/3] staging: vc04_services: Support module autoloading using MODULE_DEVICE_TABLE Date: Wed, 18 Oct 2023 01:35:09 +0530 Message-Id: <20231017200511.678223-2-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231017200511.678223-1-umang.jain@ideasonboard.com> References: <20231017200511.678223-1-umang.jain@ideasonboard.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231017_130531_851289_23429614 X-CRM114-Status: GOOD ( 14.57 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org VC04 has now a independent bus vchiq_bus to register its devices. However, the module auto-loading for bcm2835-audio and bcm2835-camera currently happens through MODULE_ALIAS() macro specified explicitly. The correct way to auto-load a module, is when the alias is picked out from MODULE_DEVICE_TABLE(). In order to get there, we need to introduce vchiq_device_id and add relevant entries in file2alias.c infrastructure so that aliases can be generated. This patch targets adding vchiq_bus_device_id and do_vchiq_bus_entry, in order to generate those alias using the /script/mod/file2alias.c. Going forward the MODULE_ALIAS() from bcm2835-camera and bcm2835-audio will be dropped, in favour of MODULE_DEVICE_TABLE being used there. The alias format for vchiq_bus devices will be "vchiq_bus:". Adjust the vchiq_bus_uevent() to reflect that. Signed-off-by: Umang Jain --- .../vc04_services/interface/vchiq_arm/vchiq_bus.c | 2 +- .../vc04_services/interface/vchiq_arm/vchiq_bus.h | 3 +++ include/linux/mod_devicetable.h | 4 ++++ scripts/mod/devicetable-offsets.c | 3 +++ scripts/mod/file2alias.c | 9 +++++++++ 5 files changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.c index 0076d091b9b2..5930eb6a86cd 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.c @@ -26,7 +26,7 @@ static int vchiq_bus_uevent(const struct device *dev, struct kobj_uevent_env *en { const struct vchiq_device *device = container_of_const(dev, struct vchiq_device, dev); - return add_uevent_var(env, "MODALIAS=%s", dev_name(&device->dev)); + return add_uevent_var(env, "MODALIAS=vchiq_bus:%s", dev_name(&device->dev)); } static int vchiq_bus_probe(struct device *dev) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.h index 7eaaf9a91cda..6e1fbee4b078 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.h @@ -7,6 +7,7 @@ #define _VCHIQ_DEVICE_H #include +#include struct vchiq_device { struct device dev; @@ -18,6 +19,8 @@ struct vchiq_driver { int (*resume)(struct vchiq_device *device); int (*suspend)(struct vchiq_device *device, pm_message_t state); + + const struct vchiq_bus_device_id *id_table; struct device_driver driver; }; diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index b0678b093cb2..f01e175f7f3d 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h @@ -946,4 +946,8 @@ struct cdx_device_id { __u32 override_only; }; +struct vchiq_bus_device_id { + char name[32]; +}; + #endif /* LINUX_MOD_DEVICETABLE_H */ diff --git a/scripts/mod/devicetable-offsets.c b/scripts/mod/devicetable-offsets.c index abe65f8968dd..c9a02d2c4f9e 100644 --- a/scripts/mod/devicetable-offsets.c +++ b/scripts/mod/devicetable-offsets.c @@ -267,5 +267,8 @@ int main(void) DEVID_FIELD(cdx_device_id, device); DEVID_FIELD(cdx_device_id, override_only); + DEVID(vchiq_bus_device_id); + DEVID_FIELD(vchiq_bus_device_id, name); + return 0; } diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 38120f932b0d..6908dc70b649 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c @@ -1478,6 +1478,14 @@ static int do_cdx_entry(const char *filename, void *symval, return 1; } +static int do_vchiq_bus_entry(const char *filename, void *symval, char *alias) +{ + DEF_FIELD_ADDR(symval, vchiq_bus_device_id, name); + sprintf(alias, "vchiq_bus:%s", *name); + + return 1; +} + /* Does namelen bytes of name exactly match the symbol? */ static bool sym_is(const char *name, unsigned namelen, const char *symbol) { @@ -1558,6 +1566,7 @@ static const struct devtable devtable[] = { {"dfl", SIZE_dfl_device_id, do_dfl_entry}, {"ishtp", SIZE_ishtp_device_id, do_ishtp_entry}, {"cdx", SIZE_cdx_device_id, do_cdx_entry}, + {"vchiq_bus", SIZE_vchiq_bus_device_id, do_vchiq_bus_entry}, }; /* Create MODULE_ALIAS() statements. From patchwork Tue Oct 17 20:05:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 13425958 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3BC58CDB483 for ; Tue, 17 Oct 2023 20:06:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9yy3WKiFZ0J0tHm5R3JZ4HY8QgUYNE34nhOJoqeVtg4=; b=UyQ4zzeUJuYABm F7Rz5lvUD10uMAtl87pnhVNhnnvPj9sa6HmDGAFeRSFZcxtnRH89IrFIfCbipP0/usDabhDJfsBNk 5CIzKs1QpsBUo4bxUeWzDrejgSeYWnqhkYaCxzPO8JLgW067Znu4leHI+p7rSU8fh2iM/3xnYnX+Q iq5Fo2CNKA90e4s8Fm+AOVtQYKuhDalb4QkSSkGoh4QVhhIqaNVbOoEDshR8KkLvQyNvMb/5728Ag Wj047wIwVCxh74B8Q3+OVXsT+pBJ7rwRI81Jec6Ki+/UjuTgSEpYIhXV4smBjzPaSXbQJKt+OlQmq 8s8PWXztM9BKBgf4uWvw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qsqK1-00DAHI-0o; Tue, 17 Oct 2023 20:05:45 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qsqJo-00DAEE-0C; Tue, 17 Oct 2023 20:05:34 +0000 Received: from umang.jainideasonboard.com (unknown [103.251.226.39]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C6391735; Tue, 17 Oct 2023 22:05:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1697573124; bh=xzrYWoOvVrM0rZ9vBAEGglUHYsnMRSjF5q/pboHaYGU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bBLgXnRiLBVc04k5NahYb5Lmlc9qZqRCbp9cb+oV/Y4tI0W8yEoBYaBmVFlLkefjP Zfs1uLdTYvE+k+5cdEyoznC9AcVlTYNi41Hc7o6D/c9u3OGVr6yg0e348QzQR0Nt/C b9bDAQ8FW3hz6Nyw/Ca4cQ1WywKNnqxVrLwclyFs= From: Umang Jain To: linux-staging@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-rpi-kernel@lists.infradead.org, linux-media@vger.kernel.org Cc: Stefan Wahren , Greg Kroah-Hartman , Dan Carpenter , Kieran Bingham , Laurent Pinchart , Umang Jain Subject: [PATCH 2/3] staging: vc04_services: bcm2835-audio: Drop MODULE_ALIAS Date: Wed, 18 Oct 2023 01:35:10 +0530 Message-Id: <20231017200511.678223-3-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231017200511.678223-1-umang.jain@ideasonboard.com> References: <20231017200511.678223-1-umang.jain@ideasonboard.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231017_130532_238256_EC8FC5C3 X-CRM114-Status: UNSURE ( 8.84 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Drop MODULE_ALIAS in favour of MODULE_DEVICE_TABLE as the module alias should be dropped from there. Signed-off-by: Umang Jain --- drivers/staging/vc04_services/bcm2835-audio/bcm2835.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c index 06bdc7673d4b..bb4ac7f5ad8f 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c @@ -311,12 +311,18 @@ static int snd_bcm2835_alsa_resume(struct vchiq_device *device) #endif +static struct vchiq_bus_device_id device_id_table[] = { + { .name = "bcm2835-audio" } +}; +MODULE_DEVICE_TABLE(vchiq_bus, device_id_table); + static struct vchiq_driver bcm2835_alsa_driver = { .probe = snd_bcm2835_alsa_probe, #ifdef CONFIG_PM .suspend = snd_bcm2835_alsa_suspend, .resume = snd_bcm2835_alsa_resume, #endif + .id_table = device_id_table, .driver = { .name = "bcm2835-audio", }, @@ -326,4 +332,3 @@ module_vchiq_driver(bcm2835_alsa_driver); MODULE_AUTHOR("Dom Cobley"); MODULE_DESCRIPTION("Alsa driver for BCM2835 chip"); MODULE_LICENSE("GPL"); -MODULE_ALIAS("bcm2835-audio"); From patchwork Tue Oct 17 20:05:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 13425959 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3FD54CDB474 for ; Tue, 17 Oct 2023 20:06:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4dN09OuJzRLChZptoEmtjzfee+7MgTjqadBwO9AN8D8=; b=EHcaOCnWjaFvR6 uAeDj5bgTdXYDK1bMHFnNLrILLM2xftoF/YdSUzjuAjXFigmwWMi+RW3LHijV3rqeRNn1LaDEHOIY /HqUgebZoDI9pAF2Q/+72K30agmeOOEEg2RvYA5RG8IQGfU3Gbiis9FEqL9w4YdGQyHpwgIIxsTGM IG+lBCRud3KTYzSV81BRL4kEY5YFXFLhhLun/fb1omcEbctcF0rmiYK8HR+B0fUY8ZpPfxGyPvKOD 4HaSkPsCEvGahL2N3OsuWRzVURU8bnjJ6XHumeaM7dMPwuH762ietnFeyFTp+I87+Fhl7oaDKWvvh g3Y/0onIg1w3sWq6+gbA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qsqK7-00DAIx-1b; Tue, 17 Oct 2023 20:05:51 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qsqJq-00DAFE-2W; Tue, 17 Oct 2023 20:05:36 +0000 Received: from umang.jainideasonboard.com (unknown [103.251.226.39]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 96A26896; Tue, 17 Oct 2023 22:05:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1697573126; bh=nd7rHyBKUfldOwcG/wXZdy58DTZYnnBemMWna4eYMUU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JYm8Xo90ibGFok6hP+jW8+PRHKU9pPiZwYXhW56pCAgVyGRGM9J5Ql6ak1lFYXajr 6ZFCfoBUyUDApFT5VprrMstRaxEdKJRil3NOTzbrAyNAt5c/D0ba1etcsK9iK287A2 e1JyB5brKSMiW3MAy+k5d972sSw14HL16VpNDm1U= From: Umang Jain To: linux-staging@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-rpi-kernel@lists.infradead.org, linux-media@vger.kernel.org Cc: Stefan Wahren , Greg Kroah-Hartman , Dan Carpenter , Kieran Bingham , Laurent Pinchart , Umang Jain Subject: [PATCH 3/3] staging: vc04_services: bcm2835-camera: Drop MODULE_ALIAS Date: Wed, 18 Oct 2023 01:35:11 +0530 Message-Id: <20231017200511.678223-4-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231017200511.678223-1-umang.jain@ideasonboard.com> References: <20231017200511.678223-1-umang.jain@ideasonboard.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231017_130534_976977_CE956A04 X-CRM114-Status: UNSURE ( 8.38 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Drop MODULE_ALIAS in favour of MODULE_DEVICE_TABLE as the module alias should be picked from there. Signed-off-by: Umang Jain --- .../staging/vc04_services/bcm2835-camera/bcm2835-camera.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c index c873eace1437..3c18376003ff 100644 --- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c @@ -1995,9 +1995,15 @@ static void bcm2835_mmal_remove(struct vchiq_device *device) vchiq_mmal_finalise(instance); } +static const struct vchiq_bus_device_id id_table[] = { + { .name = "bcm2835-camera" } +}; +MODULE_DEVICE_TABLE(vchiq_bus, id_table); + static struct vchiq_driver bcm2835_camera_driver = { .probe = bcm2835_mmal_probe, .remove = bcm2835_mmal_remove, + .id_table = id_table, .driver = { .name = "bcm2835-camera", }, @@ -2008,4 +2014,3 @@ module_vchiq_driver(bcm2835_camera_driver) MODULE_DESCRIPTION("Broadcom 2835 MMAL video capture"); MODULE_AUTHOR("Vincent Sanders"); MODULE_LICENSE("GPL"); -MODULE_ALIAS("bcm2835-camera");