From: Greg KH <gregkh@suse.de>
To: Dave Young <hidave.darkstar@gmail.com>
Cc: a.zummo@towertech.it, dbrownell@users.sourceforge.net,
rtc-linux@googlegroups.com, linux-scsi@vger.kernel.org,
peterz@infradead.org, linux-kernel@vger.kernel.org,
James.Bottomley@hansenpartnership.com, cbou@mail.ru,
Stefan Richter <stefanr@s5r6.in-berlin.de>,
stern@rowland.harvard.edu, jarkao2@gmail.com,
spi-devel-general@lists.sourceforge.net,
David Brownell <david-b@pacbell.net>,
linux1394-devel@lists.sourceforge.net, dwmw2@infradead.org,
davem@davemloft.net, krh@redhat.com
Subject: Re: [PATCH 0/7] convert semaphore to mutex in struct class
Date: Tue, 8 Jan 2008 14:48:37 -0800 [thread overview]
Message-ID: <20080108224837.GA19623@suse.de> (raw)
In-Reply-To: <a8e1da0801072305x3378c195qeb0bb7027030254c@mail.gmail.com>
On Tue, Jan 08, 2008 at 03:05:10PM +0800, Dave Young wrote:
> On Jan 8, 2008 1:20 AM, Greg KH <gregkh@suse.de> wrote:
> > On Mon, Jan 07, 2008 at 06:13:37PM +0100, Stefan Richter wrote:
> > > It's already in the driver core to the most part. It remains to be seen
> > > what is less complicated in the end: Transparent mutex-protected list
> > > accesses provided by driver core (requires the iterator), or all the
> > > necessary locking done by the drivers themselves (requires some more
> > > lock-taking but perhaps fewer lock instances overall in the drivers, and
> > > respective redefinitions and documentation of the driver core API).
> >
> > I favor changing the driver core api and doing this kind of thing there.
> > It keeps the drivers simpler and should hopefully make their lives
> > easier.
>
> What about this?
>
> #define class_for_each_dev(pos, head, member) \
> for (mutex_lock(&(container_of(head, struct class, devices))->mutex), po
> s = list_entry((head)->next, typeof(*pos), member); \
> prefetch(pos->member.next), &pos->member != (head) ? 1 : (mutex_unlock(&
> (container_of(head, struct class, devices))->mutex), 0); \
> pos = list_entry(pos->member.next, typeof(*pos), member))
Eeek, just make the thing a function please, where you pass the iterator
function in, like the driver core has (driver_for_each_device)
thanks,
greg k-h
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
WARNING: multiple messages have this Message-ID (diff)
From: Greg KH <gregkh@suse.de>
To: Dave Young <hidave.darkstar@gmail.com>
Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>,
James.Bottomley@hansenpartnership.com,
dbrownell@users.sourceforge.net, linux-scsi@vger.kernel.org,
a.zummo@towertech.it, peterz@infradead.org, cbou@mail.ru,
linux-kernel@vger.kernel.org,
David Brownell <david-b@pacbell.net>,
krh@redhat.com, stern@rowland.harvard.edu,
rtc-linux@googlegroups.com,
spi-devel-general@lists.sourceforge.net,
linux1394-devel@lists.sourceforge.net, dwmw2@infradead.org,
davem@davemloft.net, jarkao2@gmail.com
Subject: Re: [PATCH 0/7] convert semaphore to mutex in struct class
Date: Tue, 8 Jan 2008 14:48:37 -0800 [thread overview]
Message-ID: <20080108224837.GA19623@suse.de> (raw)
In-Reply-To: <a8e1da0801072305x3378c195qeb0bb7027030254c@mail.gmail.com>
On Tue, Jan 08, 2008 at 03:05:10PM +0800, Dave Young wrote:
> On Jan 8, 2008 1:20 AM, Greg KH <gregkh@suse.de> wrote:
> > On Mon, Jan 07, 2008 at 06:13:37PM +0100, Stefan Richter wrote:
> > > It's already in the driver core to the most part. It remains to be seen
> > > what is less complicated in the end: Transparent mutex-protected list
> > > accesses provided by driver core (requires the iterator), or all the
> > > necessary locking done by the drivers themselves (requires some more
> > > lock-taking but perhaps fewer lock instances overall in the drivers, and
> > > respective redefinitions and documentation of the driver core API).
> >
> > I favor changing the driver core api and doing this kind of thing there.
> > It keeps the drivers simpler and should hopefully make their lives
> > easier.
>
> What about this?
>
> #define class_for_each_dev(pos, head, member) \
> for (mutex_lock(&(container_of(head, struct class, devices))->mutex), po
> s = list_entry((head)->next, typeof(*pos), member); \
> prefetch(pos->member.next), &pos->member != (head) ? 1 : (mutex_unlock(&
> (container_of(head, struct class, devices))->mutex), 0); \
> pos = list_entry(pos->member.next, typeof(*pos), member))
Eeek, just make the thing a function please, where you pass the iterator
function in, like the driver core has (driver_for_each_device)
thanks,
greg k-h
next prev parent reply other threads:[~2008-01-08 22:48 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-03 5:50 [PATCH 0/7] convert semaphore to mutex in struct class Dave Young
2008-01-03 7:06 ` Jarek Poplawski
2008-01-03 7:24 ` Jarek Poplawski
2008-01-03 7:21 ` Dave Young
2008-01-03 7:41 ` Jarek Poplawski
2008-01-06 18:41 ` Stefan Richter
2008-01-07 2:09 ` Dave Young
2008-01-07 2:09 ` Dave Young
2008-01-07 8:45 ` Greg KH
2008-01-07 8:45 ` Greg KH
2008-01-07 9:01 ` David Brownell
2008-01-07 9:01 ` David Brownell
2008-01-07 13:23 ` Stefan Richter
2008-01-07 13:23 ` Stefan Richter
2008-01-07 14:00 ` Jarek Poplawski
2008-01-07 14:00 ` Jarek Poplawski
2008-01-07 16:36 ` Stefan Richter
2008-01-07 15:44 ` Greg KH
2008-01-07 15:44 ` Greg KH
2008-01-07 17:13 ` Stefan Richter
2008-01-07 17:20 ` Greg KH
2008-01-08 7:05 ` Dave Young
2008-01-08 22:48 ` Greg KH [this message]
2008-01-08 22:48 ` Greg KH
2008-01-09 1:32 ` Dave Young
2008-01-09 1:32 ` Dave Young
2008-01-09 6:13 ` Dave Young
2008-01-09 6:13 ` Dave Young
2008-01-09 6:37 ` Dave Young
2008-01-09 6:39 ` Dave Young
2008-01-09 6:39 ` Dave Young
2008-01-10 9:48 ` Dave Young
2008-01-10 12:34 ` Stefan Richter
2008-01-10 12:34 ` Stefan Richter
2008-01-11 2:18 ` Dave Young
2008-01-11 2:18 ` Dave Young
2008-01-10 13:23 ` Cornelia Huck
2008-01-11 2:33 ` Dave Young
2008-01-11 2:33 ` Dave Young
2008-01-11 8:23 ` Cornelia Huck
2008-01-11 8:53 ` Dave Young
2008-01-11 8:53 ` Dave Young
2008-01-10 15:41 ` Alan Stern
2008-01-10 15:41 ` Alan Stern
2008-01-11 2:37 ` Dave Young
2008-01-11 2:37 ` Dave Young
2008-01-10 18:39 ` Greg KH
2008-01-11 2:40 ` Dave Young
2008-01-11 2:40 ` Dave Young
2008-01-07 17:25 ` Alan Stern
2008-01-07 17:25 ` Alan Stern
2008-01-07 10:00 ` Dave Young
2008-01-07 10:00 ` Dave Young
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080108224837.GA19623@suse.de \
--to=gregkh@suse.de \
--cc=James.Bottomley@hansenpartnership.com \
--cc=a.zummo@towertech.it \
--cc=cbou@mail.ru \
--cc=davem@davemloft.net \
--cc=david-b@pacbell.net \
--cc=dbrownell@users.sourceforge.net \
--cc=dwmw2@infradead.org \
--cc=hidave.darkstar@gmail.com \
--cc=jarkao2@gmail.com \
--cc=krh@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linux1394-devel@lists.sourceforge.net \
--cc=peterz@infradead.org \
--cc=rtc-linux@googlegroups.com \
--cc=spi-devel-general@lists.sourceforge.net \
--cc=stefanr@s5r6.in-berlin.de \
--cc=stern@rowland.harvard.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.