All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: Ben Dooks <ben.dooks-4yDnlxn2s6sWdaTGBSpHTA@public.gmane.org>
Cc: Ian Molton <ian.molton-4yDnlxn2s6sWdaTGBSpHTA@public.gmane.org>,
	magnus.damm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-sh-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] EMMA: Add em i2c driver
Date: Wed, 04 Sep 2013 12:06:13 +0000	[thread overview]
Message-ID: <20130904140613.2b47e4a7@skate> (raw)
In-Reply-To: <5225DC8E.7070001-4yDnlxn2s6sWdaTGBSpHTA@public.gmane.org>

Dear Ben Dooks,

On Tue, 03 Sep 2013 13:56:46 +0100, Ben Dooks wrote:

> > +static int em_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
> > +	int num)
> > +{
> > +	struct em_i2c_device *i2c_dev > > +		(struct em_i2c_device *)(i2c_get_adapdata(adap));
> 
> if this is used enough it may have been easier to add an to_em_i2c()
> macro.

Or simply realize that i2c_get_adapdata() returns a 'void *' and that
therefore the cast is unnecessary, which makes a to_em_i2c() macro
useless, no?

I.e, you should be able to write:

	struct em_i2c_device *i2c_dev = i2c_get_adapdata(adap);

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

WARNING: multiple messages have this Message-ID (diff)
From: Thomas Petazzoni <thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
To: Ben Dooks <ben.dooks-4yDnlxn2s6sWdaTGBSpHTA@public.gmane.org>
Cc: Ian Molton <ian.molton-4yDnlxn2s6sWdaTGBSpHTA@public.gmane.org>,
	magnus.damm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-sh-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] EMMA: Add em i2c driver
Date: Wed, 4 Sep 2013 14:06:13 +0200	[thread overview]
Message-ID: <20130904140613.2b47e4a7@skate> (raw)
In-Reply-To: <5225DC8E.7070001-4yDnlxn2s6sWdaTGBSpHTA@public.gmane.org>

Dear Ben Dooks,

On Tue, 03 Sep 2013 13:56:46 +0100, Ben Dooks wrote:

> > +static int em_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
> > +	int num)
> > +{
> > +	struct em_i2c_device *i2c_dev =
> > +		(struct em_i2c_device *)(i2c_get_adapdata(adap));
> 
> if this is used enough it may have been easier to add an to_em_i2c()
> macro.

Or simply realize that i2c_get_adapdata() returns a 'void *' and that
therefore the cast is unnecessary, which makes a to_em_i2c() macro
useless, no?

I.e, you should be able to write:

	struct em_i2c_device *i2c_dev = i2c_get_adapdata(adap);

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

  parent reply	other threads:[~2013-09-04 12:06 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1377688911-10911-1-git-send-email-ian.molton@codethink.co.uk>
2013-08-29  5:33 ` [PATCH] EMMA: Add em i2c driver Magnus Damm
2013-08-29  5:33   ` Magnus Damm
     [not found]   ` <CANqRtoRK+Ur=87-me7CpP+s9SO5g0ZVZSEOrqwDf4HFfjZZmZA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-08-29 10:24     ` Ben Dooks
2013-08-29 10:24       ` Ben Dooks
2013-08-29 13:35       ` Ian Molton
2013-08-29 13:35         ` Ian Molton
2013-09-03 11:30     ` EMMA I2C driver Ian Molton
2013-09-03 11:30       ` Ian Molton
2013-09-03 11:30       ` [PATCH] EMMA: Add em i2c driver Ian Molton
2013-09-03 11:30         ` Ian Molton
2013-09-03 12:56         ` Ben Dooks
2013-09-03 12:56           ` Ben Dooks
     [not found]           ` <5225DC8E.7070001-4yDnlxn2s6sWdaTGBSpHTA@public.gmane.org>
2013-09-04 12:06             ` Thomas Petazzoni [this message]
2013-09-04 12:06               ` Thomas Petazzoni
     [not found] ` <1377688911-10911-1-git-send-email-ian.molton-4yDnlxn2s6sWdaTGBSpHTA@public.gmane.org>
2013-09-03 16:49   ` [Patch v3]EMMA I2C driver Ian Molton
2013-09-03 16:49     ` Ian Molton
2013-09-03 16:49     ` [PATCH 1/2] I2C: EMMA Mobile I2C master driver Ian Molton
2013-09-03 16:49       ` Ian Molton
2013-09-05  6:04       ` Simon Horman
2013-09-05  6:04         ` Simon Horman
2013-09-25  4:45         ` Simon Horman
2013-09-25  4:45           ` Simon Horman
2013-12-06 20:52           ` Ian Molton
2013-12-11  2:09             ` Simon Horman
2013-12-11  2:09               ` Simon Horman
2013-12-11 11:59               ` Wolfram Sang
2013-12-11 11:59                 ` Wolfram Sang
2014-01-08 10:33                 ` Ian Molton
     [not found]       ` <1378226969-18722-2-git-send-email-ian.molton-4yDnlxn2s6sWdaTGBSpHTA@public.gmane.org>
2014-02-18 17:38         ` Wolfram Sang
2014-02-18 17:38           ` Wolfram Sang
2014-06-17  9:57           ` Wolfram Sang
2014-06-17  9:57             ` Wolfram Sang
2014-07-18 15:45             ` Wolfram Sang
2014-07-18 15:45               ` Wolfram Sang
2014-08-22  2:57               ` Wolfram Sang
2014-08-22  2:57                 ` Wolfram Sang
2013-08-28 14:04 [PATCH] EMMA: Add em i2c driver y
2013-08-28 14:10 ` Ben Dooks
2013-08-28 14:10   ` Ben Dooks
2013-08-28 15:08 ` Ian Molton
  -- strict thread matches above, loose matches on Subject: below --
2013-08-28 14:04 y
2013-08-28 14:04 y

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=20130904140613.2b47e4a7@skate \
    --to=thomas.petazzoni@free-electrons.com \
    --cc=ben.dooks-4yDnlxn2s6sWdaTGBSpHTA@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=ian.molton-4yDnlxn2s6sWdaTGBSpHTA@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-sh-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=magnus.damm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.