Re: [PATCH v4] ata/pata_buddha: Probe via modalias instead of initcall

From: Bartlomiej Zolnierkiewicz
Date: Mon Aug 12 2019 - 08:15:12 EST



On 8/12/19 12:55 PM, Max Staudt wrote:
> Hi Bartlomiej,
>
> Thanks for your feedback!

Hi Max,

> On 08/12/2019 12:42 PM, Bartlomiej Zolnierkiewicz wrote:
>>
>> ide/buddha driver cannot be unloaded currently (it lacks module_exit()).
>>
>> [... snip ...]
>>
>> It should work exactly like the old code in case of X-Surf,
>> what do we need to release?
>
>
> So what shall I do? Once an X-Surf has been detected, we refuse to
> unload, and therefore we never have to release X-Surf resources?
> That would simplify things a lot.

Yes, it seems to be a simplest solution.

> What's a good way to do that, given that we now have module_exit()> defined and an exit function is void?

What about something like this:

static bool xsurf_present;
...
static int __init pata_buddha_late_init(void)
...
if (pata_buddha_probe(z, &xsurf_ent) == 0 &&
xsurf_present == false)
xsurf_present = true;
...
static void __exit pata_buddha_exit(void)
...
if (xsurf_present)
return -EBUSY;
...

?

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics