Update the Archimedes parallel port driver for new module API.

Update the Archimedes parallel port driver for new module API.

Post by Bob Mille » Sun, 16 Feb 2003 02:00:24



The patch below updates the Archimedes parallel port driver to use the new
module interfaces.  This hasn't been test (sorry no hardware).

--

Open Source Development Lab                     Phone: 503.626.2455 Ext. 17

diff -Nru a/drivers/parport/parport_arc.c b/drivers/parport/parport_arc.c
--- a/drivers/parport/parport_arc.c     Fri Feb 14 09:50:44 2003

        return data_copy;
 }

-static void arc_inc_use_count(void)
+static int arc_inc_use_count(void)
 {
-#ifdef MODULE
-       MOD_INC_USE_COUNT;
-#endif
+       return try_module_get(THIS_MODULE);
 }

 static void arc_dec_use_count(void)
 {
-#ifdef MODULE
-       MOD_DEC_USE_COUNT;
-#endif
+       module_put(THIS_MODULE);
 }


 {
        /* Archimedes hardware provides only one port, at a fixed address */
        struct parport *p;
+       struct resource res;
+       char *fake_name = "parport probe");

-       if (check_region(PORT_BASE, 1))
+       res = request_region(PORT_BASE, 1, fake_name);
+       if (res == NULL)
                return 0;

        p = parport_register_port (PORT_BASE, IRQ_PRINTERACK,
                                   PARPORT_DMA_NONE, &parport_arc_ops);

-       if (!p)
+       if (!p) {
+               release_region(PORT_BASE, 1);
                return 0;
+       }

        p->modes = PARPORT_MODE_ARCSPP;
        p->size = 1;
+       rename_region(res, p->name);

        printk(KERN_INFO "%s: Archimedes on-board port, using irq %d\n",
               p->irq);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

Update the Archimedes parallel port driver for new module API.

Post by Bob Mille » Sun, 16 Feb 2003 02:40:10




> > --- a/drivers/parport/parport_arc.c   Fri Feb 14 09:50:44 2003

> [...]

> > +     char *fake_name = "parport probe");

> Surely that can't be correct?  (The parenthesis at the end there, I
> mean...)

Sigh...  Corrected diff below...

--

Open Source Development Lab                     Phone: 503.626.2455 Ext. 17

diff -Nru a/drivers/parport/parport_arc.c b/drivers/parport/parport_arc.c
--- a/drivers/parport/parport_arc.c     Fri Feb 14 09:50:44 2003

        return data_copy;
 }

-static void arc_inc_use_count(void)
+static int arc_inc_use_count(void)
 {
-#ifdef MODULE
-       MOD_INC_USE_COUNT;
-#endif
+       return try_module_get(THIS_MODULE);
 }

 static void arc_dec_use_count(void)
 {
-#ifdef MODULE
-       MOD_DEC_USE_COUNT;
-#endif
+       module_put(THIS_MODULE);
 }


 {
        /* Archimedes hardware provides only one port, at a fixed address */
        struct parport *p;
+       struct resource res;
+       char *fake_name = "parport probe";

-       if (check_region(PORT_BASE, 1))
+       res = request_region(PORT_BASE, 1, fake_name);
+       if (res == NULL)
                return 0;

        p = parport_register_port (PORT_BASE, IRQ_PRINTERACK,
                                   PARPORT_DMA_NONE, &parport_arc_ops);

-       if (!p)
+       if (!p) {
+               release_region(PORT_BASE, 1);
                return 0;
+       }

        p->modes = PARPORT_MODE_ARCSPP;
        p->size = 1;
+       rename_region(res, p->name);

        printk(KERN_INFO "%s: Archimedes on-board port, using irq %d\n",
               p->irq);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

Update the Archimedes parallel port driver for new module API.

Post by Russell Kin » Sun, 16 Feb 2003 12:10:07



> -static void arc_inc_use_count(void)
> +static int arc_inc_use_count(void)
>  {
> -#ifdef MODULE
> -  MOD_INC_USE_COUNT;
> -#endif
> +  return try_module_get(THIS_MODULE);
>  }

Isn't one of the points of the module system that we don't try to run
code inside a module without the module being reference counted?

The normal way this is done is to add the module structure pointer into
a structure, and run try_module_get() from code external to the module
in question.  The above method would seem to violate that.

Rusty - comments?

--

             http://www.arm.linux.org.uk/personal/aboutme.html

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

Update the Archimedes parallel port driver for new module API.

Post by Rusty Russel » Tue, 18 Feb 2003 05:10:07




> > -static void arc_inc_use_count(void)
> > +static int arc_inc_use_count(void)
> >  {
> > -#ifdef MODULE
> > -     MOD_INC_USE_COUNT;
> > -#endif
> > +     return try_module_get(THIS_MODULE);
> >  }

> Isn't one of the points of the module system that we don't try to run
> code inside a module without the module being reference counted?

Exactly.  You can do it if you *know* you already hold a reference
count, but as a general rule it's damn suspicious.

This looks wrong,
Rusty.
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

Update the Archimedes parallel port driver for new module API.

Post by Bob Mille » Tue, 18 Feb 2003 19:10:16





> > > -static void arc_inc_use_count(void)
> > > +static int arc_inc_use_count(void)
> > >  {
> > > -#ifdef MODULE
> > > -        MOD_INC_USE_COUNT;
> > > -#endif
> > > +        return try_module_get(THIS_MODULE);
> > >  }

> > Isn't one of the points of the module system that we don't try to run
> > code inside a module without the module being reference counted?

> Exactly.  You can do it if you *know* you already hold a reference
> count, but as a general rule it's damn suspicious.

> This looks wrong,
> Rusty.

Thanks for the feed back.  I'll fix this and re-submit.

--

Open Source Development Lab                     Phone: 503.626.2455 Ext. 17
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

1. Update the Amiga parallel port driver for new module API.

The patch below updates the Amiga parallel port driver to use the new module
interfaces.  This hasn't been test (sorry no hardware).

--

Open Source Development Lab                     Phone: 503.626.2455 Ext. 17

diff -Nru a/drivers/parport/parport_amiga.c b/drivers/parport/parport_amiga.c
--- a/drivers/parport/parport_amiga.c   Fri Feb 14 09:50:44 2003

        mb();
 }

-static void amiga_inc_use_count(void)
+static int amiga_inc_use_count(void)
 {
-       MOD_INC_USE_COUNT;
+       return try_module_get(THIS_MODULE);
 }

 static void amiga_dec_use_count(void)
 {
-       MOD_DEC_USE_COUNT;
+       module_put(THIS_MODULE);
 }

 static struct parport_operations pp_amiga_ops = {
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

2. Solaris 8 ufsdump much slower than Solaris 7 ufsdump

3. Update the Atari parallel port driver for new module API.

4. curses.h

5. Update the PC parallel port driver for new module API.

6. Solaris/NT and RFC1179 Printing

7. Update the GSC-Bus parallel port driver for new module API.

8. PPP and Red Hat v4.1

9. Update the Multiface 3 parallel port driver for new module API.

10. Update the Sun parallel port driver for new module API.

11. Update parallel port drivers to module loader API.

12. Update parport class driver to new module loader API.

13. update md driver to new module API