Re: [PATCH v1 1/2] media: rc: Add user count to rc dev.

2013-07-19 Thread Srinivas KANDAGATLA
On 19/07/13 12:01, Sean Young wrote: >> +int rval = 0; >> >> -return rdev->open(rdev); >> +if (!rdev->users++) >> +rval = rdev->open(rdev); >> + >> +if (rval) >> +rdev->users--; >> + >> +return rval; > > This looks racey. Some locking is needed, I

Re: [PATCH v1 1/2] media: rc: Add user count to rc dev.

2013-07-19 Thread Sean Young
On Fri, Jul 19, 2013 at 09:39:27AM +0100, Srinivas KANDAGATLA wrote: > From: Srinivas Kandagatla > > This patch adds user count to rc_dev structure, the reason to add this > new member is to allow other code like lirc to open rc device directly. > In the existing code, rc device is only opened

[PATCH v1 1/2] media: rc: Add user count to rc dev.

2013-07-19 Thread Srinivas KANDAGATLA
From: Srinivas Kandagatla This patch adds user count to rc_dev structure, the reason to add this new member is to allow other code like lirc to open rc device directly. In the existing code, rc device is only opened by input subsystem which works ok if we have any input drivers to match. But in

[PATCH v1 1/2] media: rc: Add user count to rc dev.

2013-07-19 Thread Srinivas KANDAGATLA
From: Srinivas Kandagatla srinivas.kandaga...@st.com This patch adds user count to rc_dev structure, the reason to add this new member is to allow other code like lirc to open rc device directly. In the existing code, rc device is only opened by input subsystem which works ok if we have any input

Re: [PATCH v1 1/2] media: rc: Add user count to rc dev.

2013-07-19 Thread Sean Young
On Fri, Jul 19, 2013 at 09:39:27AM +0100, Srinivas KANDAGATLA wrote: From: Srinivas Kandagatla srinivas.kandaga...@st.com This patch adds user count to rc_dev structure, the reason to add this new member is to allow other code like lirc to open rc device directly. In the existing code, rc

Re: [PATCH v1 1/2] media: rc: Add user count to rc dev.

2013-07-19 Thread Srinivas KANDAGATLA
On 19/07/13 12:01, Sean Young wrote: +int rval = 0; -return rdev-open(rdev); +if (!rdev-users++) +rval = rdev-open(rdev); + +if (rval) +rdev-users--; + +return rval; This looks racey. Some locking is needed, I think rc_dev-lock should