lkml.org 
[lkml]   [2019]   [Jul]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v2] ata/pata_buddha: Probe via modalias instead of initcall
Hi Max,

On Thu, Jul 25, 2019 at 3:25 PM Max Staudt <max@enpas.org> wrote:
> Up until now, the pata_buddha driver would only check for cards on
> initcall time. Now, the kernel will call its probe function as soon
> as a compatible card is detected.
>
> Device removal remains unimplemented. A WARN_ONCE() serves as a
> reminder.
>
> v2: Rename 'zdev' to 'z' to make the patch easy to analyse with
> git diff --ignore-space-change
>
> Tested-by: Max Staudt <max@enpas.org>
> Signed-off-by: Max Staudt <max@enpas.org>

Thanks for your patch!

> --- a/drivers/ata/pata_buddha.c
> +++ b/drivers/ata/pata_buddha.c

> @@ -145,111 +146,162 @@ static struct ata_port_operations pata_xsurf_ops = {
> .set_mode = pata_buddha_set_mode,
> };
>
> -static int __init pata_buddha_init_one(void)
> +static int pata_buddha_probe(struct zorro_dev *z,
> + const struct zorro_device_id *ent)
> {

[...]

> + switch (z->id) {
> + case ZORRO_PROD_INDIVIDUAL_COMPUTERS_BUDDHA:
> + default:
> + type = BOARD_BUDDHA;
> + break;
> + case ZORRO_PROD_INDIVIDUAL_COMPUTERS_CATWEASEL:
> + type = BOARD_CATWEASEL;
> + nr_ports++;
> + break;
> + case ZORRO_PROD_INDIVIDUAL_COMPUTERS_X_SURF:
> + type = BOARD_XSURF;
> + break;
> + }

Please obtain the type from ent->driver_data instead of using a switch()
statement...

> -module_init(pata_buddha_init_one);
> +static const struct zorro_device_id pata_buddha_zorro_tbl[] = {
> + { ZORRO_PROD_INDIVIDUAL_COMPUTERS_BUDDHA, },
> + { ZORRO_PROD_INDIVIDUAL_COMPUTERS_CATWEASEL, },
> + { ZORRO_PROD_INDIVIDUAL_COMPUTERS_X_SURF, },

... after storing it in zorro_device_id.driver_data here.

> + { 0 }
> +};

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

\
 
 \ /
  Last update: 2019-07-29 10:53    [W:0.093 / U:0.884 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site