All of lore.kernel.org
 help / color / mirror / Atom feed
From: guz.fnst@cn.fujitsu.com (Gu Zheng)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 00/19] driver:usb&net: add missing platform_driver owner
Date: Tue, 21 May 2013 16:50:38 +0800	[thread overview]
Message-ID: <519B355E.8020505@cn.fujitsu.com> (raw)
In-Reply-To: <519B2FC7.6000801@huawei.com>

On 05/21/2013 04:26 PM, Libo Chen wrote:

> On 2013/5/21 16:00, Gu Zheng wrote:
>> On 05/21/2013 02:41 PM, Thomas Petazzoni wrote:
>>
>>> Dear David Miller,
>>>
>>> On Mon, 20 May 2013 23:26:19 -0700 (PDT), David Miller wrote:
>>>> From: Libo Chen <libo.chen@huawei.com>
>>>> Date: Tue, 21 May 2013 10:42:00 +0800
>>>>
>>>>> I find a lot of mistakes using struct platform_driver without owner.
>>>>> So I pick up some of them including usb and net modules
>>>>
>>>> Instead of doing it this way, which is obviously error prone and
>>>> easy to forget, make platform_driver_register() be a macro which
>>>> sets the module owner field then calls the real
>>>> __platform_driver_register().
>>>
>>> Or, maybe make the existing module_platform_driver() macro do this?
>>
>>
>> But not all the modules use module_platform_driver() macro to replace the module init/exit.
>>
>> Thanks,
>> Gu
>>
> 
> yes, there are many drivers register platform_driver by platform_driver_register manually.
> 
> make both platform_driver_register() and module_platform_driver()  to check and set the module owner field?


No, module_platform_driver() will call platform_driver_register() to register platform_driver, just do it in
platform_driver_register() is enough.
As David mentioned, making platform_driver_register() be a macro and sets the module owner field in it, seems
a good way.

Thanks,
Gu

> 
> 
> 
>>>
>>> Best regards,
>>>
>>> Thomas
>>
>>
>>
>> .
>>
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 

WARNING: multiple messages have this Message-ID (diff)
From: Gu Zheng <guz.fnst@cn.fujitsu.com>
To: Libo Chen <clbchenlibo.chen@huawei.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
	David Miller <davem@davemloft.net>,
	libo.chen@huawei.com, gregkh@linuxfoundation.org,
	samuel@sortiz.org, stern@rowland.harvard.edu, khc@pm.waw.pl,
	akpm@linux-foundation.org, balbi@ti.com,
	sarah.a.sharp@linux.intel.com,
	alexander.shishkin@linux.intel.com, brudley@broadcom.com,
	linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, lizefan@huawei.com
Subject: Re: [PATCH 00/19] driver:usb&net: add missing platform_driver owner
Date: Tue, 21 May 2013 16:50:38 +0800	[thread overview]
Message-ID: <519B355E.8020505@cn.fujitsu.com> (raw)
In-Reply-To: <519B2FC7.6000801@huawei.com>

On 05/21/2013 04:26 PM, Libo Chen wrote:

> On 2013/5/21 16:00, Gu Zheng wrote:
>> On 05/21/2013 02:41 PM, Thomas Petazzoni wrote:
>>
>>> Dear David Miller,
>>>
>>> On Mon, 20 May 2013 23:26:19 -0700 (PDT), David Miller wrote:
>>>> From: Libo Chen <libo.chen@huawei.com>
>>>> Date: Tue, 21 May 2013 10:42:00 +0800
>>>>
>>>>> I find a lot of mistakes using struct platform_driver without owner.
>>>>> So I pick up some of them including usb and net modules
>>>>
>>>> Instead of doing it this way, which is obviously error prone and
>>>> easy to forget, make platform_driver_register() be a macro which
>>>> sets the module owner field then calls the real
>>>> __platform_driver_register().
>>>
>>> Or, maybe make the existing module_platform_driver() macro do this?
>>
>>
>> But not all the modules use module_platform_driver() macro to replace the module init/exit.
>>
>> Thanks,
>> Gu
>>
> 
> yes, there are many drivers register platform_driver by platform_driver_register manually.
> 
> make both platform_driver_register() and module_platform_driver()  to check and set the module owner field?


No, module_platform_driver() will call platform_driver_register() to register platform_driver, just do it in
platform_driver_register() is enough.
As David mentioned, making platform_driver_register() be a macro and sets the module owner field in it, seems
a good way.

Thanks,
Gu

> 
> 
> 
>>>
>>> Best regards,
>>>
>>> Thomas
>>
>>
>>
>> .
>>
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 



  reply	other threads:[~2013-05-21  8:50 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-21  2:42 [PATCH 00/19] driver:usb&net: add missing platform_driver owner Libo Chen
2013-05-21  2:42 ` Libo Chen
2013-05-21  6:26 ` David Miller
2013-05-21  6:26   ` David Miller
2013-05-21  6:41   ` Thomas Petazzoni
2013-05-21  6:41     ` Thomas Petazzoni
2013-05-21  7:13     ` David Miller
2013-05-21  7:13       ` David Miller
2013-05-21  8:00     ` Gu Zheng
2013-05-21  8:00       ` Gu Zheng
2013-05-21  8:26       ` Libo Chen
2013-05-21  8:26         ` Libo Chen
2013-05-21  8:50         ` Gu Zheng [this message]
2013-05-21  8:50           ` Gu Zheng
2013-05-21  9:06       ` Thomas Petazzoni
2013-05-21  9:06         ` Thomas Petazzoni
2013-05-21  9:42         ` Libo Chen
2013-05-21  9:42           ` Libo Chen
2013-05-22  1:30           ` Gu Zheng
2013-05-22  1:30             ` Gu Zheng
2013-05-21 18:40 ` Greg KH
2013-05-21 18:40   ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=519B355E.8020505@cn.fujitsu.com \
    --to=guz.fnst@cn.fujitsu.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.