From: Martyn Welch <martyn.welch@ge.com>
To: "Emilio G. Cota" <cota@braap.org>
Cc: Manohar Vanga <manohar.vanga@cern.ch>,
devel@driverdev.osuosl.org, gregkh@suse.de,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/5] staging: vme: add functions for bridge module refcounting
Date: Fri, 19 Aug 2011 09:32:09 +0100 [thread overview]
Message-ID: <4E4E1F89.4070702@ge.com> (raw)
In-Reply-To: <20110813085454.GA3409@flamenco.cs.columbia.edu>
On 13/08/11 09:54, Emilio G. Cota wrote:
> On Fri, Aug 12, 2011 at 12:30:49 +0200, Manohar Vanga wrote:
>> This patch adds functions that allow for reference counting
>> bridge modules. The patch introduces the functions
>> 'vme_bridge_get()' and 'vme_bridge_put()'.
> (snip)
>> +int vme_bridge_get(unsigned int bus_id)
> (snip)
>> +void vme_bridge_put(struct vme_bridge *bridge)
>
> Note the input parameter imbalance; in fact this is serious
> (see my email on patch 5) because _get() needs to acquire
> vme_buses_lock, whereas _put() doesn't. Since a caller with
> bridge has bridge->num, but the opposite doesn't hold (num
> doesn't give you the bridge without acquiring vme_buses_lock),
> it seems reasonable to me to take the bus_id as the input for
> both functions, because the requirements on the caller are lower.
>
Patch 4 makes changes the struct vme_bridge to struct vme_dev. Looking at the
callers we are then effectively doing:
vme_bridge_get(vme_dev.id)
Then in vme_bridge_get(), looping through all the buses to find the one with
the correct id...
We could just pass in the struct vme_dev to both functions.
Martyn
> But the locking needs to be handled with care, see my reply
> to patch 5.
>
> Emilio
>
> _______________________________________________
> devel mailing list
> devel@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/devel
--
Martyn Welch (Principal Software Engineer) | Registered in England and
GE Intelligent Platforms | Wales (3828642) at 100
T +44(0)127322748 | Barbirolli Square, Manchester,
E martyn.welch@ge.com | M2 3AB VAT:GB 927559189
next prev parent reply other threads:[~2011-08-19 8:32 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-12 10:30 [PATCH 0/5] [RESEND v2] VME Framework Fixes Manohar Vanga
2011-08-12 10:30 ` [PATCH 1/5] staging: vme: make [alloc|free]_consistent bridge specific Manohar Vanga
2011-08-16 8:15 ` Martyn Welch
2011-08-12 10:30 ` [PATCH 2/5] staging: vme: keep track of registered buses Manohar Vanga
2011-08-16 8:16 ` Martyn Welch
2011-08-12 10:30 ` [PATCH 3/5] staging: vme: add functions for bridge module refcounting Manohar Vanga
2011-08-13 7:47 ` Emilio G. Cota
2011-08-15 10:05 ` Manohar Vanga
2011-08-15 18:49 ` Emilio G. Cota
2011-08-22 12:24 ` Martyn Welch
2011-08-23 9:09 ` Manohar Vanga
2011-08-13 8:54 ` Emilio G. Cota
2011-08-19 8:32 ` Martyn Welch [this message]
2011-08-19 8:42 ` Martyn Welch
2011-08-12 10:30 ` [PATCH 4/5] staging: vme: add struct vme_dev for VME devices Manohar Vanga
2011-08-12 10:30 ` [PATCH 5/5] staging: vme: make match() driver specific to improve non-VME64x support Manohar Vanga
2011-08-13 8:50 ` Emilio G. Cota
2011-08-23 22:14 ` [PATCH 0/5] [RESEND v2] VME Framework Fixes Greg KH
2011-08-24 7:40 ` Martyn Welch
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=4E4E1F89.4070702@ge.com \
--to=martyn.welch@ge.com \
--cc=cota@braap.org \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=manohar.vanga@cern.ch \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox