[PATCH 1/2] mcb: Add missing modpost build support

Jose Javier Rodriguez Barbarin posted 2 patches 4 days, 5 hours ago
There is a newer version of this series
[PATCH 1/2] mcb: Add missing modpost build support
Posted by Jose Javier Rodriguez Barbarin 4 days, 5 hours ago
mcb bus is not prepared to autoload client drivers with the data defined on
the drivers' MODULE_DEVICE_TABLE. modpost cannot access to mcb_table_id
inside MODULE_DEVICE_TABLE so the data declared inside is ignored.

Add modpost build support for accessing to the mcb_table_id coded on device
drivers' MODULE_DEVICE_TABLE.

Reviewed-by: Jorge Sanjuan Garcia <dev-jorge.sanjuangarcia@duagon.com>
Signed-off-by: Jose Javier Rodriguez Barbarin <dev-josejavier.rodriguez@duagon.com>
---
 scripts/mod/devicetable-offsets.c | 3 +++
 scripts/mod/file2alias.c          | 9 +++++++++
 2 files changed, 12 insertions(+)

diff --git a/scripts/mod/devicetable-offsets.c b/scripts/mod/devicetable-offsets.c
index d3d00e85edf7..8e89d07a9337 100644
--- a/scripts/mod/devicetable-offsets.c
+++ b/scripts/mod/devicetable-offsets.c
@@ -209,6 +209,9 @@ int main(void)
 	DEVID_FIELD(rio_device_id, asm_did);
 	DEVID_FIELD(rio_device_id, asm_vid);
 
+	DEVID(mcb_device_id);
+	DEVID_FIELD(mcb_device_id, device);
+
 	DEVID(ulpi_device_id);
 	DEVID_FIELD(ulpi_device_id, vendor);
 	DEVID_FIELD(ulpi_device_id, product);
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index b3333560b95e..f02dfc186730 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -1144,6 +1144,14 @@ static void do_rio_entry(struct module *mod, void *symval)
 	module_alias_printf(mod, true, "rapidio:%s", alias);
 }
 
+/* Looks like: mcb:16zN */
+static void do_mcb_entry(struct module *mod, void *symval)
+{
+	DEF_FIELD(symval, mcb_device_id, device);
+
+	module_alias_printf(mod, false, "mcb:16z%03d", device);
+}
+
 /* Looks like: ulpi:vNpN */
 static void do_ulpi_entry(struct module *mod, void *symval)
 {
@@ -1446,6 +1454,7 @@ static const struct devtable devtable[] = {
 	{"cpu", SIZE_cpu_feature, do_cpu_entry},
 	{"mei", SIZE_mei_cl_device_id, do_mei_entry},
 	{"rapidio", SIZE_rio_device_id, do_rio_entry},
+	{"mcb", SIZE_mcb_device_id, do_mcb_entry},
 	{"ulpi", SIZE_ulpi_device_id, do_ulpi_entry},
 	{"hdaudio", SIZE_hda_device_id, do_hda_entry},
 	{"sdw", SIZE_sdw_device_id, do_sdw_entry},
-- 
2.51.1
Re: [PATCH 1/2] mcb: Add missing modpost build support
Posted by Andy Shevchenko 4 days, 5 hours ago
On Thu, Nov 27, 2025 at 5:56 PM Jose Javier Rodriguez Barbarin
<dev-josejavier.rodriguez@duagon.com> wrote:
>
> mcb bus is not prepared to autoload client drivers with the data defined on
> the drivers' MODULE_DEVICE_TABLE. modpost cannot access to mcb_table_id
> inside MODULE_DEVICE_TABLE so the data declared inside is ignored.
>
> Add modpost build support for accessing to the mcb_table_id coded on device
> drivers' MODULE_DEVICE_TABLE.

...

>  static const struct devtable devtable[] = {

>         {"cpu", SIZE_cpu_feature, do_cpu_entry},
>         {"mei", SIZE_mei_cl_device_id, do_mei_entry},
>         {"rapidio", SIZE_rio_device_id, do_rio_entry},
> +       {"mcb", SIZE_mcb_device_id, do_mcb_entry},

Perhaps squeeze it to be more ordered (yes, I know that the table is
not so ordered, but given context suggests to put it after "mei").

>         {"ulpi", SIZE_ulpi_device_id, do_ulpi_entry},
>         {"hdaudio", SIZE_hda_device_id, do_hda_entry},
>         {"sdw", SIZE_sdw_device_id, do_sdw_entry},



-- 
With Best Regards,
Andy Shevchenko
Re: [PATCH 1/2] mcb: Add missing modpost build support
Posted by Jiri Slaby 3 days, 13 hours ago
On 27. 11. 25, 17:10, Andy Shevchenko wrote:
>>   static const struct devtable devtable[] = {
> 
>>          {"cpu", SIZE_cpu_feature, do_cpu_entry},
>>          {"mei", SIZE_mei_cl_device_id, do_mei_entry},
>>          {"rapidio", SIZE_rio_device_id, do_rio_entry},
>> +       {"mcb", SIZE_mcb_device_id, do_mcb_entry},
> 
> Perhaps squeeze it to be more ordered (yes, I know that the table is
> not so ordered, but given context suggests to put it after "mei").

s/after/before/ :)

-- 
js
suse labs
Re: [PATCH 1/2] mcb: Add missing modpost build support
Posted by Andy Shevchenko 3 days, 12 hours ago
On Fri, Nov 28, 2025 at 08:54:18AM +0100, Jiri Slaby wrote:
> On 27. 11. 25, 17:10, Andy Shevchenko wrote:

...

> > >   static const struct devtable devtable[] = {
> > 
> > >          {"cpu", SIZE_cpu_feature, do_cpu_entry},
> > >          {"mei", SIZE_mei_cl_device_id, do_mei_entry},
> > >          {"rapidio", SIZE_rio_device_id, do_rio_entry},
> > > +       {"mcb", SIZE_mcb_device_id, do_mcb_entry},
> > 
> > Perhaps squeeze it to be more ordered (yes, I know that the table is
> > not so ordered, but given context suggests to put it after "mei").
> 
> s/after/before/ :)

Right, good catch!

-- 
With Best Regards,
Andy Shevchenko
Re: [PATCH 1/2] mcb: Add missing modpost build support
Posted by Jose Javier Rodriguez Barbarin 3 days, 10 hours ago
On Fri, Nov 28, 2025 at 11:02:57AM +0200, Andy Shevchenko wrote:
> On Fri, Nov 28, 2025 at 08:54:18AM +0100, Jiri Slaby wrote:
> > On 27. 11. 25, 17:10, Andy Shevchenko wrote:
> 
> ...
> 
> > > >   static const struct devtable devtable[] = {
> > > 
> > > >          {"cpu", SIZE_cpu_feature, do_cpu_entry},
> > > >          {"mei", SIZE_mei_cl_device_id, do_mei_entry},
> > > >          {"rapidio", SIZE_rio_device_id, do_rio_entry},
> > > > +       {"mcb", SIZE_mcb_device_id, do_mcb_entry},
> > > 
> > > Perhaps squeeze it to be more ordered (yes, I know that the table is
> > > not so ordered, but given context suggests to put it after "mei").

Thanks your answers,

I put it between "rapidio" and "ulpi" because mcb_device_id is defined in
mod_devicetable.h between rio_device_id and ulpi_device_id so I though it
could be nice to follow the same order on file2alias.c.

> > 
> > s/after/before/ :)
> 
> Right, good catch!
> 

It is OK to me, I will put it before mei ;)

> -- 
> With Best Regards,
> Andy Shevchenko
> 
>