<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/scripts/mod/file2alias.c, branch v6.13-rc4</title>
<subtitle>Linux kernel source tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/'/>
<entry>
<title>modpost: improve error messages in device_id_check()</title>
<updated>2024-11-27T23:46:02+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2024-11-19T23:56:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=2b1bd507542a6ec1506a847da8e81fc764a4e707'/>
<id>2b1bd507542a6ec1506a847da8e81fc764a4e707</id>
<content type='text'>
The first error message in device_id_check() is obscure and can be
misleading because the cause of the error is unlikely to be found in
the struct definition in mod_devicetable.h.

This type of error occurs when an array is passed to an incorrect type
of MODULE_DEVICE_TABLE().

[Example 1]

    static const struct acpi_device_id foo_ids[] = {
            { "FOO" },
            { /* sentinel */ },
    };
    MODULE_DEVICE_TABLE(of, foo_ids);

Currently, modpost outputs a meaningless suggestion:

    ERROR: modpost: ...: sizeof(struct of_device_id)=200 is not a modulo of the size of section __mod_device_table__of__&lt;identifier&gt;=64.
    Fix definition of struct of_device_id in mod_devicetable.h

The root cause here is that MODULE_DEVICE_TABLE(of, ...) is used instead
of the correct MODULE_DEVICE_TABLE(acpi, ...).

This commit provides a more intuitive error message:

    ERROR: modpost: ...: type mismatch between foo_ids[] and MODULE_DEVICE_TABLE(of, ...)

The second error message, related to a missing terminator, is too
verbose.

[Example 2]

    static const struct acpi_device_id foo_ids[] = {
            { "FOO" },
    };
    MODULE_DEVICE_TABLE(acpi, foo_ids);

The current error message is overly long, and does not pinpoint the
incorrect array:

    ...: struct acpi_device_id is 32 bytes.  The last of 1 is:
    0x46 0x4f 0x4f 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
    ERROR: modpost: ...: struct acpi_device_id is not terminated with a NULL entry!

This commit changes it to a more concise error message, sufficient to
identify the incorrect array:

    ERROR: modpost: ...: foo_ids[] is not terminated with a NULL entry

Lastly, this commit squashes device_id_check() into do_table() and
changes fatal() into error(), allowing modpost to continue processing
other modules.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The first error message in device_id_check() is obscure and can be
misleading because the cause of the error is unlikely to be found in
the struct definition in mod_devicetable.h.

This type of error occurs when an array is passed to an incorrect type
of MODULE_DEVICE_TABLE().

[Example 1]

    static const struct acpi_device_id foo_ids[] = {
            { "FOO" },
            { /* sentinel */ },
    };
    MODULE_DEVICE_TABLE(of, foo_ids);

Currently, modpost outputs a meaningless suggestion:

    ERROR: modpost: ...: sizeof(struct of_device_id)=200 is not a modulo of the size of section __mod_device_table__of__&lt;identifier&gt;=64.
    Fix definition of struct of_device_id in mod_devicetable.h

The root cause here is that MODULE_DEVICE_TABLE(of, ...) is used instead
of the correct MODULE_DEVICE_TABLE(acpi, ...).

This commit provides a more intuitive error message:

    ERROR: modpost: ...: type mismatch between foo_ids[] and MODULE_DEVICE_TABLE(of, ...)

The second error message, related to a missing terminator, is too
verbose.

[Example 2]

    static const struct acpi_device_id foo_ids[] = {
            { "FOO" },
    };
    MODULE_DEVICE_TABLE(acpi, foo_ids);

The current error message is overly long, and does not pinpoint the
incorrect array:

    ...: struct acpi_device_id is 32 bytes.  The last of 1 is:
    0x46 0x4f 0x4f 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
    ERROR: modpost: ...: struct acpi_device_id is not terminated with a NULL entry!

This commit changes it to a more concise error message, sufficient to
identify the incorrect array:

    ERROR: modpost: ...: foo_ids[] is not terminated with a NULL entry

Lastly, this commit squashes device_id_check() into do_table() and
changes fatal() into error(), allowing modpost to continue processing
other modules.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>modpost: rename alias symbol for MODULE_DEVICE_TABLE()</title>
<updated>2024-11-27T23:46:02+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2024-11-19T23:56:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=054a9cd395a79f4a5595f2cd24542e9bca8723c8'/>
<id>054a9cd395a79f4a5595f2cd24542e9bca8723c8</id>
<content type='text'>
This commit renames the alias symbol, __mod_&lt;type&gt;__&lt;name&gt;_device_table
to __mod_device_table__&lt;type&gt;__&lt;name&gt;.

This change simplifies the code slightly, as there is no longer a need
to check both the prefix and suffix.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This commit renames the alias symbol, __mod_&lt;type&gt;__&lt;name&gt;_device_table
to __mod_device_table__&lt;type&gt;__&lt;name&gt;.

This change simplifies the code slightly, as there is no longer a need
to check both the prefix and suffix.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>modpost: rename variables in handle_moddevtable()</title>
<updated>2024-11-27T23:46:02+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2024-11-19T23:56:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=9a8ace8bb2efa0ca43a77866fa9c835294b1e045'/>
<id>9a8ace8bb2efa0ca43a77866fa9c835294b1e045</id>
<content type='text'>
This commit renames the variables in handle_moddevtable() as follows:

    name       -&gt; type
    namelen    -&gt; typelen
    identifier -&gt; name

These changes align with the definition in include/linux/module.h:

  extern typeof(name) __mod_##type##__##name##_device_table

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This commit renames the variables in handle_moddevtable() as follows:

    name       -&gt; type
    namelen    -&gt; typelen
    identifier -&gt; name

These changes align with the definition in include/linux/module.h:

  extern typeof(name) __mod_##type##__##name##_device_table

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>modpost: move strstarts() to modpost.h</title>
<updated>2024-11-27T23:46:02+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2024-11-19T23:56:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=9d98038d438d8515473a75a29bc524e9a4a5882a'/>
<id>9d98038d438d8515473a75a29bc524e9a4a5882a</id>
<content type='text'>
This macro is useful in file2alias.c as well.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This macro is useful in file2alias.c as well.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>modpost: convert do_usb_table() to a generic handler</title>
<updated>2024-11-27T23:46:02+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2024-11-19T23:56:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=abd20428c3f2f8b97a2a0414343faf0ff246a018'/>
<id>abd20428c3f2f8b97a2a0414343faf0ff246a018</id>
<content type='text'>
do_usb_table() no longer needs to iterate over the usb_device_id array.

Convert it to a generic -&gt;do_entry() handler.

This is the last special case. Clean up handle_moddevtable().

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
do_usb_table() no longer needs to iterate over the usb_device_id array.

Convert it to a generic -&gt;do_entry() handler.

This is the last special case. Clean up handle_moddevtable().

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>modpost: convert do_of_table() to a generic handler</title>
<updated>2024-11-27T23:46:02+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2024-11-19T23:56:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=c58854c8e0b50c2f30c729b82b92b3fd8cc8f2c1'/>
<id>c58854c8e0b50c2f30c729b82b92b3fd8cc8f2c1</id>
<content type='text'>
do_of_table() no longer needs to iterate over the of_device_id array.

Convert it to a generic -&gt;do_entry() handler.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
do_of_table() no longer needs to iterate over the of_device_id array.

Convert it to a generic -&gt;do_entry() handler.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>modpost: convert do_pnp_device_entry() to a generic handler</title>
<updated>2024-11-27T23:46:02+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2024-11-19T23:56:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=600dbaf1e2f0c0b70b2d3e7513a161b884e7718f'/>
<id>600dbaf1e2f0c0b70b2d3e7513a161b884e7718f</id>
<content type='text'>
do_pnp_device_entry() no longer needs to iterate over the
pnp_device_id array.

Convert it to a generic -&gt;do_entry() handler.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
do_pnp_device_entry() no longer needs to iterate over the
pnp_device_id array.

Convert it to a generic -&gt;do_entry() handler.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>modpost: convert do_pnp_card_entries() to a generic handler</title>
<updated>2024-11-27T23:46:02+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2024-11-19T23:56:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=a5d8d417e62ab3823a06e1bc08634d737d810e59'/>
<id>a5d8d417e62ab3823a06e1bc08634d737d810e59</id>
<content type='text'>
do_pnp_card_entries() no longer needs to iterate over the
pnp_card_device_id array.

Convert it to a generic -&gt;do_entry() handler.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
do_pnp_card_entries() no longer needs to iterate over the
pnp_card_device_id array.

Convert it to a generic -&gt;do_entry() handler.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>modpost: call module_alias_printf() from all do_*_entry() functions</title>
<updated>2024-11-27T23:46:02+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2024-11-19T23:56:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=6d3b3dd26fd71dde0b41478755a59ca30aaeb664'/>
<id>6d3b3dd26fd71dde0b41478755a59ca30aaeb664</id>
<content type='text'>
The do_*_entry() functions cannot check the length of the given buffer.

Use module_alias_printf() helper consistently for these functions.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The do_*_entry() functions cannot check the length of the given buffer.

Use module_alias_printf() helper consistently for these functions.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>modpost: pass (struct module *) to do_*_entry() functions</title>
<updated>2024-11-27T23:46:02+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2024-11-19T23:56:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=c7c24d60151c022bd8e357f5395a327d354a676a'/>
<id>c7c24d60151c022bd8e357f5395a327d354a676a</id>
<content type='text'>
Replace the first argument with a pointer to struct module.

'filename' can be replaced with mod-&gt;name.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Replace the first argument with a pointer to struct module.

'filename' can be replaced with mod-&gt;name.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
