linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] crypto: picoxcell - Fix module autoload for non-OF registration
@ 2017-01-02 15:38 Javier Martinez Canillas
  2017-01-02 16:05 ` Arnd Bergmann
  0 siblings, 1 reply; 5+ messages in thread
From: Javier Martinez Canillas @ 2017-01-02 15:38 UTC (permalink / raw)
  To: linux-kernel
  Cc: Javier Martinez Canillas, Jamie Iles, David S. Miller,
	linux-crypto, Herbert Xu, linux-arm-kernel

If the driver is built as a module, autoload won't work because the module
alias information is not filled. So user-space can't match the registered
device with the corresponding module if the device isn't registered via OF.

Export the module alias information using the MODULE_DEVICE_TABLE() macro.

Before this patch:

$ modinfo drivers/crypto/picoxcell_crypto.ko | grep alias
alias:          of:N*T*Cpicochip,spacc-l2C*
alias:          of:N*T*Cpicochip,spacc-l2
alias:          of:N*T*Cpicochip,spacc-ipsecC*
alias:          of:N*T*Cpicochip,spacc-ipsec

After this patch:

$ modinfo drivers/crypto/picoxcell_crypto.ko | grep alias
alias:          of:N*T*Cpicochip,spacc-l2C*
alias:          of:N*T*Cpicochip,spacc-l2
alias:          of:N*T*Cpicochip,spacc-ipsecC*
alias:          of:N*T*Cpicochip,spacc-ipsec
alias:          platform:picochip,spacc-l2
alias:          platform:picochip,spacc-ipsec

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
---

 drivers/crypto/picoxcell_crypto.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/crypto/picoxcell_crypto.c b/drivers/crypto/picoxcell_crypto.c
index 47576098831f..64449b7c00af 100644
--- a/drivers/crypto/picoxcell_crypto.c
+++ b/drivers/crypto/picoxcell_crypto.c
@@ -1808,6 +1808,7 @@ static const struct platform_device_id spacc_id_table[] = {
 	{ "picochip,spacc-l2", },
 	{ }
 };
+MODULE_DEVICE_TABLE(platform, spacc_id_table);
 
 static struct platform_driver spacc_driver = {
 	.probe		= spacc_probe,
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] crypto: picoxcell - Fix module autoload for non-OF registration
  2017-01-02 15:38 [PATCH] crypto: picoxcell - Fix module autoload for non-OF registration Javier Martinez Canillas
@ 2017-01-02 16:05 ` Arnd Bergmann
  2017-01-02 16:13   ` Javier Martinez Canillas
  0 siblings, 1 reply; 5+ messages in thread
From: Arnd Bergmann @ 2017-01-02 16:05 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Javier Martinez Canillas, linux-kernel, Herbert Xu, linux-crypto,
	Jamie Iles, David S. Miller

On Monday, January 2, 2017 12:38:02 PM CET Javier Martinez Canillas wrote:
> If the driver is built as a module, autoload won't work because the module
> alias information is not filled. So user-space can't match the registered
> device with the corresponding module if the device isn't registered via OF.
> 
> Export the module alias information using the MODULE_DEVICE_TABLE() macro.

I think we can just remove the table, as the platform only supports
booting through DT anyway.

	Arnd

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] crypto: picoxcell - Fix module autoload for non-OF registration
  2017-01-02 16:05 ` Arnd Bergmann
@ 2017-01-02 16:13   ` Javier Martinez Canillas
  2017-01-02 16:24     ` Arnd Bergmann
  0 siblings, 1 reply; 5+ messages in thread
From: Javier Martinez Canillas @ 2017-01-02 16:13 UTC (permalink / raw)
  To: Arnd Bergmann, linux-arm-kernel
  Cc: linux-kernel, Herbert Xu, linux-crypto, Jamie Iles, David S. Miller

Hello Arnd,

On 01/02/2017 01:05 PM, Arnd Bergmann wrote:
> On Monday, January 2, 2017 12:38:02 PM CET Javier Martinez Canillas wrote:
>> If the driver is built as a module, autoload won't work because the module
>> alias information is not filled. So user-space can't match the registered
>> device with the corresponding module if the device isn't registered via OF.
>>
>> Export the module alias information using the MODULE_DEVICE_TABLE() macro.
> 
> I think we can just remove the table, as the platform only supports
> booting through DT anyway.
> 

Agreed. I should had checked if mach-picoxcell was DT-only indeed.

Should I also make the driver to depend on OF and remove the #ifdefery then?

> 	Arnd
> 

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] crypto: picoxcell - Fix module autoload for non-OF registration
  2017-01-02 16:13   ` Javier Martinez Canillas
@ 2017-01-02 16:24     ` Arnd Bergmann
  2017-01-02 16:32       ` Javier Martinez Canillas
  0 siblings, 1 reply; 5+ messages in thread
From: Arnd Bergmann @ 2017-01-02 16:24 UTC (permalink / raw)
  To: Javier Martinez Canillas
  Cc: linux-arm-kernel, linux-kernel, Herbert Xu, linux-crypto,
	Jamie Iles, David S. Miller

On Monday, January 2, 2017 1:13:24 PM CET Javier Martinez Canillas wrote:
> Hello Arnd,
> 
> On 01/02/2017 01:05 PM, Arnd Bergmann wrote:
> > On Monday, January 2, 2017 12:38:02 PM CET Javier Martinez Canillas wrote:
> >> If the driver is built as a module, autoload won't work because the module
> >> alias information is not filled. So user-space can't match the registered
> >> device with the corresponding module if the device isn't registered via OF.
> >>
> >> Export the module alias information using the MODULE_DEVICE_TABLE() macro.
> > 
> > I think we can just remove the table, as the platform only supports
> > booting through DT anyway.
> > 
> 
> Agreed. I should had checked if mach-picoxcell was DT-only indeed.
> 
> Should I also make the driver to depend on OF and remove the #ifdefery then?

I don't think we need a dependency, the #ifdef checks in there were needed
only to make the driver smaller if OF is disabled and it should still build
fine if someone tries to compile it for CONFIG_COMPILE_TEST without
CONFIG_OF.

If we remove the platform ID, we can however also remove the 
spacc_is_compatible() function and just call of_device_is_compatible()
in its place.

	Arnd

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] crypto: picoxcell - Fix module autoload for non-OF registration
  2017-01-02 16:24     ` Arnd Bergmann
@ 2017-01-02 16:32       ` Javier Martinez Canillas
  0 siblings, 0 replies; 5+ messages in thread
From: Javier Martinez Canillas @ 2017-01-02 16:32 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-arm-kernel, linux-kernel, Herbert Xu, linux-crypto,
	Jamie Iles, David S. Miller

On 01/02/2017 01:24 PM, Arnd Bergmann wrote:
> On Monday, January 2, 2017 1:13:24 PM CET Javier Martinez Canillas wrote:
>> Hello Arnd,
>>
>> On 01/02/2017 01:05 PM, Arnd Bergmann wrote:
>>> On Monday, January 2, 2017 12:38:02 PM CET Javier Martinez Canillas wrote:
>>>> If the driver is built as a module, autoload won't work because the module
>>>> alias information is not filled. So user-space can't match the registered
>>>> device with the corresponding module if the device isn't registered via OF.
>>>>
>>>> Export the module alias information using the MODULE_DEVICE_TABLE() macro.
>>>
>>> I think we can just remove the table, as the platform only supports
>>> booting through DT anyway.
>>>
>>
>> Agreed. I should had checked if mach-picoxcell was DT-only indeed.
>>
>> Should I also make the driver to depend on OF and remove the #ifdefery then?
> 
> I don't think we need a dependency, the #ifdef checks in there were needed
> only to make the driver smaller if OF is disabled and it should still build
> fine if someone tries to compile it for CONFIG_COMPILE_TEST without
> CONFIG_OF.
>

OK, the driver doesn't depend on COMPILE_TEST though but I agree with you
since it seems the driver only has runtime but no build time dependencies
with ARCH_PICOXCELL.
 
> If we remove the platform ID, we can however also remove the 
> spacc_is_compatible() function and just call of_device_is_compatible()
> in its place.
>

Yes.

> 	Arnd
> 

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-01-02 16:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-02 15:38 [PATCH] crypto: picoxcell - Fix module autoload for non-OF registration Javier Martinez Canillas
2017-01-02 16:05 ` Arnd Bergmann
2017-01-02 16:13   ` Javier Martinez Canillas
2017-01-02 16:24     ` Arnd Bergmann
2017-01-02 16:32       ` Javier Martinez Canillas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).