From: "Manuel J. Galan" <man...@step.es>
Subject: pre-2.1.127-2 problem with parport_share.c
Date: 1998/10/27
Message-ID: <fa.h7p2hmv.dga2b9@ifi.uio.no>#1/1
X-Deja-AN: 405624492
Original-Date: Tue, 27 Oct 1998 14:56:13 -0000 (WET)
Sender: owner-lin...@vger.rutgers.edu
Content-Transfer-Encoding: 7BIT
Original-Message-ID: <XFMail.981027...@step.es>
To: Linux Kernel List <linux-...@vger.rutgers.edu>
X-Priority: 3 (Normal)
Content-Type: text/plain; charset=US-ASCII
X-Orcpt: rfc822;li...@vger.rutgers.edu
Organization: ULPGC
MIME-Version: 1.0
Reply-To: "Manuel J. Galan" <man...@step.es>
Newsgroups: fa.linux.kernel
X-Loop: majo...@vger.rutgers.edu




--- drivers/misc/parport_share.c.bad  Tue Oct 27 14:08:43 1998
+++ drivers/misc/parport_share.c      Tue Oct 27 14:50:28 1998
@@ -62,6 +62,7 @@
        struct parport *tmp;
        int portnum;
        char *name;
+       rwlock_t  tmp_rw_lock = RW_LOCK_UNLOCKED;
 
        /* Check for a previously registered port.
           NOTE: we will ignore irq and dma if we find a previously
@@ -105,7 +106,7 @@
        tmp->ops = ops;
        tmp->number = portnum;
        memset (&tmp->probe_info, 0, sizeof (struct parport_device_info));
-       tmp->cad_lock = RW_LOCK_UNLOCKED;
+       memcpy (&tmp->cad_lock, &tmp_rw_lock, sizeof (tmp_rw_lock));
        spin_lock_init(&tmp->waitlist_lock);
        spin_lock_init(&tmp->pardevice_lock);
 
----------------------------------
E-Mail: Manuel J. Galan <man...@step.es>
Date: 27-Oct-98
Time: 14:52:29

This message was sent by XFMail
----------------------------------

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majo...@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

From: Horst von Brand <vonb...@inf.utfsm.cl>
Subject: Re: pre-2.1.127-2 problem with parport_share.c 
Date: 1998/10/27
Message-ID: <fa.j37ldrv.1r2gp97@ifi.uio.no>#1/1
X-Deja-AN: 405630367
Original-Date: Tue, 27 Oct 1998 13:47:27 -0300
Sender: owner-lin...@vger.rutgers.edu
Original-Message-Id: <1998102716...@pincoya.inf.utfsm.cl>
References: <fa.h7p2hmv.dga2b9@ifi.uio.no>
To: "Manuel J. Galan" <man...@step.es>
X-Orcpt: rfc822;li...@vger.rutgers.edu
X-charset: ISO_8859-1
Organization: Internet mailing list
Newsgroups: fa.linux.kernel
X-Loop: majo...@vger.rutgers.edu

"Manuel J. Galan" <man...@step.es> said:
> --- drivers/misc/parport_share.c.bad  Tue Oct 27 14:08:43 1998
> +++ drivers/misc/parport_share.c      Tue Oct 27 14:50:28 1998
> @@ -62,6 +62,7 @@
>         struct parport *tmp;
>         int portnum;
>         char *name;
> +       rwlock_t  tmp_rw_lock = RW_LOCK_UNLOCKED;
>  
>         /* Check for a previously registered port.
>            NOTE: we will ignore irq and dma if we find a previously
> @@ -105,7 +106,7 @@
>         tmp->ops = ops;
>         tmp->number = portnum;
>         memset (&tmp->probe_info, 0, sizeof (struct parport_device_info));
> -       tmp->cad_lock = RW_LOCK_UNLOCKED;
> +       memcpy (&tmp->cad_lock, &tmp_rw_lock, sizeof (tmp_rw_lock));
>         spin_lock_init(&tmp->waitlist_lock);
>         spin_lock_init(&tmp->pardevice_lock);

I'd much prefer a macro for setting/initializing spinlocks that you can
define as empty where not used.

Just 2 cents.
-- 
Dr. Horst H. von Brand                       mailto:vonb...@inf.utfsm.cl
Departamento de Informatica                     Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria              +56 32 654239
Casilla 110-V, Valparaiso, Chile                Fax:  +56 32 797513

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majo...@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

From: "Manuel J. Galan" <man...@step.es>
Subject: Re: pre-2.1.127-2 problem with parport_share.c
Date: 1998/10/27
Message-ID: <fa.h5paiev.fg21j8@ifi.uio.no>#1/1
X-Deja-AN: 405718338
Original-Date: Tue, 27 Oct 1998 19:42:51 -0000 (WET)
Sender: owner-lin...@vger.rutgers.edu
Content-Transfer-Encoding: 7BIT
Original-Message-ID: <XFMail.981027...@step.es>
References: <fa.j37ldrv.1r2gp97@ifi.uio.no>
To: Horst von Brand <vonb...@inf.utfsm.cl>
X-Priority: 3 (Normal)
Content-Type: text/plain; charset=US-ASCII
X-Orcpt: rfc822;li...@vger.rutgers.edu
Organization: ULPGC
MIME-Version: 1.0
Reply-To: "Manuel J. Galan" <man...@step.es>
Newsgroups: fa.linux.kernel
X-Loop: majo...@vger.rutgers.edu


I'd too.

The problem is that it is not an initialization but an asignment.
Then gcc barfs and stops on error; because you can not use = to asign
a structure...(gcc-2.7.2.3)


On 27-Oct-98 Horst von Brand wrote:
> "Manuel J. Galan" <man...@step.es> said:
>> --- drivers/misc/parport_share.c.bad  Tue Oct 27 14:08:43 1998
>> +++ drivers/misc/parport_share.c      Tue Oct 27 14:50:28 1998
>> @@ -62,6 +62,7 @@
>>         struct parport *tmp;
>>         int portnum;
>>         char *name;
>> +       rwlock_t  tmp_rw_lock = RW_LOCK_UNLOCKED;
>>  
>>         /* Check for a previously registered port.
>>            NOTE: we will ignore irq and dma if we find a previously
>> @@ -105,7 +106,7 @@
>>         tmp->ops = ops;
>>         tmp->number = portnum;
>>         memset (&tmp->probe_info, 0, sizeof (struct parport_device_info));
>> -       tmp->cad_lock = RW_LOCK_UNLOCKED;
>> +       memcpy (&tmp->cad_lock, &tmp_rw_lock, sizeof (tmp_rw_lock));
>>         spin_lock_init(&tmp->waitlist_lock);
>>         spin_lock_init(&tmp->pardevice_lock);
> 
> I'd much prefer a macro for setting/initializing spinlocks that you can
> define as empty where not used.
> 
> Just 2 cents.
> -- 
> Dr. Horst H. von Brand                       mailto:vonb...@inf.utfsm.cl
> Departamento de Informatica                     Fono: +56 32 654431
> Universidad Tecnica Federico Santa Maria              +56 32 654239
> Casilla 110-V, Valparaiso, Chile                Fax:  +56 32 797513

----------------------------------
E-Mail: Manuel J. Galan <man...@step.es>
Date: 27-Oct-98
Time: 19:40:21

This message was sent by XFMail
----------------------------------

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majo...@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

From: "William R. Dirks" <di...@netcom.com>
Subject: Initializing non-static locks
Date: 1998/10/28
Message-ID: <fa.fpidnkv.15ho8jn@ifi.uio.no>#1/1
X-Deja-AN: 405794583
Original-Date: Tue, 27 Oct 1998 15:02:00 -0800 (PST)
Sender: owner-lin...@vger.rutgers.edu
Content-Transfer-Encoding: 7bit
Original-Message-Id: <1998102723...@netcom7.netcom.com>
References: <fa.h5paiev.fg21j8@ifi.uio.no>
To: linux-...@vger.rutgers.edu
Content-Type: text/plain; charset=US-ASCII
X-Orcpt: rfc822;li...@vger.rutgers.edu
Organization: Internet mailing list
MIME-Version: 1.0
Newsgroups: fa.linux.kernel
X-Loop: majo...@vger.rutgers.edu

I hit this problem in my driver. The way I solved it was to make a
static variable
rwlock_t rw_lock_unlocked = RW_LOCK_UNLOCKED;

Then use rw_lock_unlocked instead of RW_LOCK_UNLOCKED. Maybe that is an 
idea for the kernel?

Bill.

> The problem is that it is not an initialization but an asignment.
> Then gcc barfs and stops on error; because you can not use = to asign
> a structure...(gcc-2.7.2.3)
> 
> On 27-Oct-98 Horst von Brand wrote:
> > "Manuel J. Galan" <man...@step.es> said:
> >> -       tmp->cad_lock = RW_LOCK_UNLOCKED;
> >> +       memcpy (&tmp->cad_lock, &tmp_rw_lock, sizeof (tmp_rw_lock));


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majo...@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

From: sm...@noris.de (Matthias Urlichs)
Subject: Re: Initializing non-static locks
Date: 1998/10/30
Message-ID: <fa.eulgdfv.1m1i2hj@ifi.uio.no>#1/1
X-Deja-AN: 406680095
Original-Date: 30 Oct 1998 15:06:01 +0100
Sender: owner-lin...@vger.rutgers.edu
Content-Transfer-Encoding: 7BIT
Original-Message-ID: <71ch49$gh$1...@work.noris.de>
References: <fa.coteihv.1eho6p1@ifi.uio.no>
To: linux-...@vger.rutgers.edu
Original-References: <XFMail.981027...@step.es> 
<1998102723...@netcom7.netcom.com> <9095456...@noris.de>
Content-Type: text/plain; charset=US-ASCII
X-Orcpt: rfc822;li...@vger.rutgers.edu
Original-Path: noris.net!noris.net!not-for-mail
Organization: noris network GmbH, Nuernberg, FRG
Mime-Version: 1.0
Newsgroups: fa.linux.kernel
Original-NNTP-Posting-Host: work.noris.de
X-Loop: majo...@vger.rutgers.edu
Original-Newsgroups: dist.linux.kernel

  "William R. Dirks" <di...@netcom.com> writes:
> I hit this problem in my driver. The way I solved it was to make a
> static variable
> rwlock_t rw_lock_unlocked = RW_LOCK_UNLOCKED;
> 
> Then use rw_lock_unlocked instead of RW_LOCK_UNLOCKED. Maybe that is an 
> idea for the kernel?
> 
No, the problem is that if you assign a struct to a variable (EXCEPT where
declaring the variable), you have to typecode the struct. The very idea of
assigning a constant struct to a variable is a GCC extension. Basically you
write it like this:

     structure = ((struct foo) {x + y, 'a', 0});

The whole right side of this should have been in the definition of the
RW_LOCK_UNLOCKED macro, not just the part between-and-including the braces.

See also the "Constructors" node of gcc.info.

-- 
Matthias Urlichs  |  noris network GmbH   |   sm...@noris.de  |  ICQ: 20193661
The quote was selected randomly. Really.    |      http://www.noris.de/~smurf/
-- 
Honest criticism is hard to take, particularly from a relative, a
friend, an acquaintance, or a stranger.
                -- Franklin P. Jones

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majo...@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/