[lkml]   [2011]   [Aug]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 3/5] staging: vme: add functions for bridge module refcounting
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()'.
> +int vme_bridge_get(unsigned int bus_id)
> +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.

But the locking needs to be handled with care, see my reply
to patch 5.


 \ /
  Last update: 2011-08-13 10:57    [from the cache]
©2003-2014 Jasper Spaans. hosted at Digital Ocean