[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <04309f46208b6aa26c989a2cfcfa38b6@codeaurora.org>
Date: Wed, 18 Dec 2019 02:47:33 +0800
From: cang@...eaurora.org
To: Bart Van Assche <bvanassche@....org>
Cc: Bjorn Andersson <bjorn.andersson@...aro.org>,
asutoshd@...eaurora.org, nguyenb@...eaurora.org,
rnayak@...eaurora.org, linux-scsi@...r.kernel.org,
kernel-team@...roid.com, saravanak@...gle.com, salyzyn@...gle.com,
Alim Akhtar <alim.akhtar@...sung.com>,
Avri Altman <avri.altman@....com>,
Pedro Sousa <pedrom.sousa@...opsys.com>,
"James E.J. Bottomley" <jejb@...ux.ibm.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
Evan Green <evgreen@...omium.org>,
Kishon Vijay Abraham I <kishon@...com>,
Stephen Boyd <swboyd@...omium.org>,
Stanley Chu <stanley.chu@...iatek.com>,
Vignesh Raghavendra <vigneshr@...com>,
Bean Huo <beanhuo@...ron.com>,
Venkat Gopalakrishnan <venkatg@...eaurora.org>,
Tomas Winkler <tomas.winkler@...el.com>,
Arnd Bergmann <arnd@...db.de>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 2/3] scsi: ufs: Modulize ufs-bsg
On 2019-12-18 02:19, Bart Van Assche wrote:
> On 12/17/19 12:56 AM, cang@...eaurora.org wrote:
>> Even in the current ufs_bsg.c, it creates two devices, one is ufs-bsg,
>> one is the char dev node under /dev/bsg. Why this becomes a problem
>> after make it a module?
>>
>> I took a look into the pci_driver, it is no different than making
>> ufs-bsg
>> a plain device. The only special place about pci_driver is that it has
>> its
>> own probe() and remove(), and the probe() in its bus_type calls the
>> probe() in pci_driver. Meaning the bus->probe() is an intermediate
>> call
>> used to pass whatever needed by pci_driver->probe().
>>
>> Of course we can also do this, but isn't it too much for ufs-bsg?
>> For our case, calling set_dev_drvdata(bsg_dev, hba) to pass hba to
>> ufs_bsg.c would be enough.
>>
>> If you take a look at the V3 patch, the change makes the ufs_bsg.c
>> much conciser. platform_device_register_data() does everything for us,
>> initialize the device, set device name, provide the match func,
>> bus type and release func.
>>
>> Since ufs-bsg is somewhat not a platform device, we can still add it
>> as a plain device, just need a few more lines to get it initialized.
>> This allows us leverage kernel's device driver model. Just like Greg
>> commented, we don't need to re-implement the mechanism again.
>
> Hi Can,
>
> Since ufs-bsg is not a platform device I think it would be wrong to
> model ufs-bsg devices as platform devices.
>
> Please have a look at the bus_register() and bus_unregister()
> functions as Greg KH asked. Using the bus abstraction is not that
> hard. An example is e.g. available in the scsi_debug driver, namely
> the pseudo_lld_bus.
>
> Thanks,
>
> Bart.
Hi Bart,
Yes, I am talking the same here. Since platform device is not an option
for ufs-bsg, to make it a plain device we would need to do
bus_register()
and bus_unregister(). And also do device_initialize() and device_add().
Thanks,
Can Guo.
Powered by blists - more mailing lists