From: Sangbeom Kim <sbkim73@samsung.com>
To: "'Samuel Ortiz'" <sameo@linux.intel.com>
Cc: linux-kernel@vger.kernel.org
Subject: RE: [PATCH 2/3] mfd: Add initial S5M8751 support
Date: Tue, 05 Jul 2011 08:49:14 +0900 [thread overview]
Message-ID: <035b01cc3aa4$fb4fa490$f1eeedb0$@com> (raw)
In-Reply-To: <20110704140731.GC3021@sortiz-mobl>
Hi,
Thanks for your kindly comment.
On Monday, July 04, 2011 11:08 PM +0900, Samuel Ortiz wrote:
> On Wed, Jun 22, 2011 at 02:53:56PM +0900, Sangbeom Kim wrote:
> > +#define SLEEPB_ENABLE 1
> > +#define SLEEPB_DISABLE 0
> > +
> > +static DEFINE_MUTEX(io_mutex);
> I would prefer to see your IO mutex defined from your s5m8751 structure.
Ok, I will make IO mutex in s5m8751 structure in the next version.
>
> > +int s5m8751_clear_bits(struct s5m8751 *s5m8751, uint8_t reg, uint8_t
> mask)
> > +{
> > + uint8_t reg_val;
> > + int ret = 0;
> > +
> > + ret = s5m8751_reg_read(s5m8751, reg, ®_val);
> > + if (ret)
> > + return ret;
> > +
> > + reg_val &= ~mask;
> > + ret = s5m8751_reg_write(s5m8751, reg, reg_val);
> > +
> > + return ret;
> > +}
> > +EXPORT_SYMBOL_GPL(s5m8751_clear_bits);
> > +
> > +int s5m8751_set_bits(struct s5m8751 *s5m8751, uint8_t reg, uint8_t
mask)
> > +{
> > + uint8_t reg_val;
> > + int ret = 0;
> > +
> > + ret = s5m8751_reg_read(s5m8751, reg, ®_val);
> > + if (ret)
> > + return ret;
> > +
> > + reg_val |= mask;
> > + ret = s5m8751_reg_write(s5m8751, reg, reg_val);
> > +
> > + return ret;
> > +}
> > +EXPORT_SYMBOL_GPL(s5m8751_set_bits);
> Your locking for both of those routines is also racy. There's nothing
> preventing a writre to happen between your read and your write. They need
> to
> happen atomically, and for that you need to take the lonk in the clear/set
> bits routine.
Ok, I will add mutex_lock between read and write in the next version.
Sooner or later, I will submit new patches.
Thanks,
SB Kim
next prev parent reply other threads:[~2011-07-04 23:49 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-22 5:53 [PATCH 0/3] S5M8751 core driver Sangbeom Kim
2011-06-22 5:53 ` [PATCH 1/3] mfd: Add S5M8751 register definitions Sangbeom Kim
2011-06-22 12:42 ` Mark Brown
2011-06-22 23:59 ` Sangbeom Kim
2011-06-22 5:53 ` [PATCH 2/3] mfd: Add initial S5M8751 support Sangbeom Kim
2011-06-22 12:48 ` Mark Brown
2011-06-23 1:14 ` Sangbeom Kim
2011-07-04 14:07 ` Samuel Ortiz
2011-07-04 23:49 ` Sangbeom Kim [this message]
2011-06-22 5:53 ` [PATCH 3/3] mfd: Add I2C control support for S5M8751 Sangbeom Kim
2011-06-22 8:56 ` Maxin B John
2011-06-22 12:50 ` Mark Brown
2011-06-23 1:25 ` Sangbeom Kim
2011-06-23 1:28 ` Mark Brown
2011-06-23 2:21 ` Sangbeom Kim
2011-06-23 10:35 ` Mark Brown
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='035b01cc3aa4$fb4fa490$f1eeedb0$@com' \
--to=sbkim73@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sameo@linux.intel.com \
/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