From: "Tirdea, Irina" <irina.tirdea@intel.com>
To: Jonathan Cameron <jic23@kernel.org>,
"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
Hartmut Knaack <knaack.h@gmx.de>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH 2/8] iio: accel: mma9553: use unsigned counters
Date: Mon, 13 Apr 2015 13:54:52 +0000 [thread overview]
Message-ID: <1F3AC3675D538145B1661F571FE1805F19A4F5F1@irsmsx105.ger.corp.intel.com> (raw)
In-Reply-To: <55266447.50909@kernel.org>
> -----Original Message-----
> From: Jonathan Cameron [mailto:jic23@kernel.org]
> Sent: 09 April, 2015 14:37
> To: Tirdea, Irina; linux-iio@vger.kernel.org; Hartmut Knaack
> Cc: linux-kernel@vger.kernel.org
> Subject: Re: [PATCH 2/8] iio: accel: mma9553: use unsigned counters
>
> On 08/04/15 15:37, Irina Tirdea wrote:
> > Use unsigned counters instead of signed when all the
> > possible values are positive.
> >
> > Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
> > Suggested-by: Hartmut Knaack <knaack.h@gmx.de>
> Does it make sense to carry this through to mma9551_transfer as well?
> Can't say I really care about this one. It's nice, but the compiler may
> well mess with the types used anyway given it can trivially tell their limits...
>
> Still it does no harm so what the heck. Certainly not a high
> priority change though.
Indeed, I should also change mma9551_transfer signature to reflect the changes for length.
Since this is just a "nice to have" change, will add it at the end of the series.
Thanks,
Irina
> > ---
> > drivers/iio/accel/mma9551_core.c | 11 +++++------
> > drivers/iio/accel/mma9553.c | 8 ++++----
> > 2 files changed, 9 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/iio/accel/mma9551_core.c b/drivers/iio/accel/mma9551_core.c
> > index 54b3ae6..438cfed 100644
> > --- a/drivers/iio/accel/mma9551_core.c
> > +++ b/drivers/iio/accel/mma9551_core.c
> > @@ -387,8 +387,8 @@ EXPORT_SYMBOL(mma9551_read_status_word);
> > int mma9551_read_config_words(struct i2c_client *client, u8 app_id,
> > u16 reg, u8 len, u16 *buf)
> > {
> > - int ret, i;
> > - int len_words = len / sizeof(u16);
> > + int ret;
> > + u8 i, len_words = len / sizeof(u16);
> > __be16 be_buf[MMA9551_MAX_MAILBOX_DATA_REGS];
> >
> > ret = mma9551_transfer(client, app_id, MMA9551_CMD_READ_CONFIG,
> > @@ -422,8 +422,8 @@ EXPORT_SYMBOL(mma9551_read_config_words);
> > int mma9551_read_status_words(struct i2c_client *client, u8 app_id,
> > u16 reg, u8 len, u16 *buf)
> > {
> > - int ret, i;
> > - int len_words = len / sizeof(u16);
> > + int ret;
> > + u8 i, len_words = len / sizeof(u16);
> > __be16 be_buf[MMA9551_MAX_MAILBOX_DATA_REGS];
> >
> > ret = mma9551_transfer(client, app_id, MMA9551_CMD_READ_STATUS,
> > @@ -457,8 +457,7 @@ EXPORT_SYMBOL(mma9551_read_status_words);
> > int mma9551_write_config_words(struct i2c_client *client, u8 app_id,
> > u16 reg, u8 len, u16 *buf)
> > {
> > - int i;
> > - int len_words = len / sizeof(u16);
> > + u8 i, len_words = len / sizeof(u16);
> > __be16 be_buf[MMA9551_MAX_MAILBOX_DATA_REGS];
> >
> > for (i = 0; i < len_words; i++)
> > diff --git a/drivers/iio/accel/mma9553.c b/drivers/iio/accel/mma9553.c
> > index d095f81..9cfedb5 100644
> > --- a/drivers/iio/accel/mma9553.c
> > +++ b/drivers/iio/accel/mma9553.c
> > @@ -184,7 +184,7 @@ struct mma9553_data {
> > struct mutex mutex;
> > struct mma9553_conf_regs conf;
> > struct mma9553_event events[MMA9553_EVENTS_INFO_SIZE];#define MMA9551_APPID_RCS 0x17
> +#define MMA9551_APPID_RSC 0x17
> > - int num_events;
> > + u8 num_events;
> > u8 gpio_bitnum;
> > /*
> > * This is used for all features that depend on step count:
> > @@ -225,7 +225,7 @@ static enum iio_modifier mma9553_activity_to_mod(enum activity_level activity)
> >
> > static void mma9553_init_events(struct mma9553_data *data)
> > {
> > - int i;
> > + u8 i;
> >
> > data->num_events = MMA9553_EVENTS_INFO_SIZE;
> > for (i = 0; i < data->num_events; i++) {
> > @@ -239,7 +239,7 @@ static struct mma9553_event *mma9553_get_event(struct mma9553_data *data,
> > enum iio_modifier mod,
> > enum iio_event_direction dir)
> > {
> > - int i;
> > + u8 i;
> >
> > for (i = 0; i < data->num_events; i++)
> > if (data->events[i].info->type == type &&
> > @@ -254,7 +254,7 @@ static bool mma9553_is_any_event_enabled(struct mma9553_data *data,
> > bool check_type,
> > enum iio_chan_type type)
> > {
> > - int i;
> > + u8 i;
> >
> > for (i = 0; i < data->num_events; i++)
> > if ((check_type && data->events[i].info->type == type &&
> >
next prev parent reply other threads:[~2015-04-13 13:55 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-08 14:37 [PATCH 0/8] Fixes for the mma9553 driver Irina Tirdea
2015-04-08 14:37 ` [PATCH 1/8] iio: accel: mma9553: coding style fixes Irina Tirdea
2015-04-09 11:31 ` Jonathan Cameron
2015-04-13 13:43 ` Tirdea, Irina
2015-04-08 14:37 ` [PATCH 2/8] iio: accel: mma9553: use unsigned counters Irina Tirdea
2015-04-09 11:36 ` Jonathan Cameron
2015-04-13 13:54 ` Tirdea, Irina [this message]
2015-04-08 14:37 ` [PATCH 3/8] iio: accel: mma9553: fix gpio bitnum init value Irina Tirdea
2015-04-09 11:42 ` Jonathan Cameron
2015-04-08 14:37 ` [PATCH 4/8] iio: accel: mma9553: refactor mma9553_read_activity_stepcnt Irina Tirdea
2015-04-09 11:44 ` Jonathan Cameron
2015-04-08 14:37 ` [PATCH 5/8] iio: accel: mma9553: refactor mma9553_read_raw Irina Tirdea
2015-04-09 11:45 ` Jonathan Cameron
2015-04-08 14:37 ` [PATCH 6/8] iio: accel: mma9553: check input value for activity period Irina Tirdea
2015-04-09 11:46 ` Jonathan Cameron
2015-04-08 14:37 ` [PATCH 7/8] iio: accel: mma9551_core: prevent buffer overrun Irina Tirdea
2015-04-09 11:51 ` Jonathan Cameron
2015-04-13 13:48 ` Tirdea, Irina
2015-04-08 14:37 ` [PATCH 8/8] iio: accel: mma9553: add enable channel for activity Irina Tirdea
2015-04-09 11:52 ` Jonathan Cameron
2015-04-09 11:13 ` [PATCH 0/8] Fixes for the mma9553 driver Jonathan Cameron
2015-04-13 13:42 ` Tirdea, Irina
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=1F3AC3675D538145B1661F571FE1805F19A4F5F1@irsmsx105.ger.corp.intel.com \
--to=irina.tirdea@intel.com \
--cc=jic23@kernel.org \
--cc=knaack.h@gmx.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).