* Re: linux-next: Tree for July 10 (iio) [not found] <20120710174320.3b7dd806e20ee74ca1b1685f@canb.auug.org.au> @ 2012-07-11 5:51 ` Randy Dunlap 2012-07-11 8:01 ` [PATCH] iio: ad5064: Move bus write callbacks to #if protected sections Lars-Peter Clausen 0 siblings, 1 reply; 3+ messages in thread From: Randy Dunlap @ 2012-07-11 5:51 UTC (permalink / raw) To: Stephen Rothwell Cc: linux-next, LKML, linux-iio, Jonathan Cameron, Lars-Peter Clausen On 07/10/2012 12:43 AM, Stephen Rothwell wrote: > Hi all, > > Changes since 20120709: > on x86_64: drivers/iio/dac/ad5064.c: In function 'ad5064_i2c_write': drivers/iio/dac/ad5064.c:132:2: error: implicit declaration of function 'i2c_master_send' -- ~Randy ^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] iio: ad5064: Move bus write callbacks to #if protected sections 2012-07-11 5:51 ` linux-next: Tree for July 10 (iio) Randy Dunlap @ 2012-07-11 8:01 ` Lars-Peter Clausen 2012-07-12 19:22 ` Jonathan Cameron 0 siblings, 1 reply; 3+ messages in thread From: Lars-Peter Clausen @ 2012-07-11 8:01 UTC (permalink / raw) To: Jonathan Cameron; +Cc: linux-iio, Randy Dunlap, linux-next, Lars-Peter Clausen Move the SPI and I2C specific write callbacks to the respective "#if IS_ENABLED(CONFIG_SPI_MASTER)" and "#if IS_ENABLED(CONFIG_I2C)" protected sections of the code. This fixes the following warning which occurs if CONFIG_I2C is not set: drivers/iio/dac/ad5064.c: In function ‘ad5064_i2c_write’: drivers/iio/dac/ad5064.c:132: error: implicit declaration of function ‘i2c_master_send’ And the follwing warning which occurs when CONFIG_SPI_MASTER is not set: drivers/iio/dac/ad5064.c:137: warning: ‘ad5064_spi_write’ defined but not used Reported-by: Randy Dunlap <rdunlap@xenotime.net> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> --- drivers/iio/dac/ad5064.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/drivers/iio/dac/ad5064.c b/drivers/iio/dac/ad5064.c index aa739c4..de2c368 100644 --- a/drivers/iio/dac/ad5064.c +++ b/drivers/iio/dac/ad5064.c @@ -122,25 +122,6 @@ enum ad5064_type { ID_AD5668_2, }; -static int ad5064_i2c_write(struct ad5064_state *st, unsigned int cmd, - unsigned int addr, unsigned int val) -{ - struct i2c_client *i2c = to_i2c_client(st->dev); - - st->data.i2c[0] = (cmd << 4) | addr; - put_unaligned_be16(val, &st->data.i2c[1]); - return i2c_master_send(i2c, st->data.i2c, 3); -} - -static int ad5064_spi_write(struct ad5064_state *st, unsigned int cmd, - unsigned int addr, unsigned int val) -{ - struct spi_device *spi = to_spi_device(st->dev); - - st->data.spi = cpu_to_be32(AD5064_CMD(cmd) | AD5064_ADDR(addr) | val); - return spi_write(spi, &st->data.spi, sizeof(st->data.spi)); -} - static int ad5064_write(struct ad5064_state *st, unsigned int cmd, unsigned int addr, unsigned int val, unsigned int shift) { @@ -533,6 +514,15 @@ static int __devexit ad5064_remove(struct device *dev) #if IS_ENABLED(CONFIG_SPI_MASTER) +static int ad5064_spi_write(struct ad5064_state *st, unsigned int cmd, + unsigned int addr, unsigned int val) +{ + struct spi_device *spi = to_spi_device(st->dev); + + st->data.spi = cpu_to_be32(AD5064_CMD(cmd) | AD5064_ADDR(addr) | val); + return spi_write(spi, &st->data.spi, sizeof(st->data.spi)); +} + static int __devinit ad5064_spi_probe(struct spi_device *spi) { const struct spi_device_id *id = spi_get_device_id(spi); @@ -596,6 +586,16 @@ static inline void ad5064_spi_unregister_driver(void) { } #if IS_ENABLED(CONFIG_I2C) +static int ad5064_i2c_write(struct ad5064_state *st, unsigned int cmd, + unsigned int addr, unsigned int val) +{ + struct i2c_client *i2c = to_i2c_client(st->dev); + + st->data.i2c[0] = (cmd << 4) | addr; + put_unaligned_be16(val, &st->data.i2c[1]); + return i2c_master_send(i2c, st->data.i2c, 3); +} + static int __devinit ad5064_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id) { -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] iio: ad5064: Move bus write callbacks to #if protected sections 2012-07-11 8:01 ` [PATCH] iio: ad5064: Move bus write callbacks to #if protected sections Lars-Peter Clausen @ 2012-07-12 19:22 ` Jonathan Cameron 0 siblings, 0 replies; 3+ messages in thread From: Jonathan Cameron @ 2012-07-12 19:22 UTC (permalink / raw) To: Lars-Peter Clausen; +Cc: Jonathan Cameron, linux-iio, Randy Dunlap, linux-next On 07/11/2012 09:01 AM, Lars-Peter Clausen wrote: > Move the SPI and I2C specific write callbacks to the respective > "#if IS_ENABLED(CONFIG_SPI_MASTER)" and "#if IS_ENABLED(CONFIG_I2C)" > protected sections of the code. >=20 > This fixes the following warning which occurs if CONFIG_I2C is not set: > drivers/iio/dac/ad5064.c: In function =E2=80=98ad5064_i2c_write=E2=80=99= : > drivers/iio/dac/ad5064.c:132: error: implicit declaration of function = =E2=80=98i2c_master_send=E2=80=99 >=20 > And the follwing warning which occurs when CONFIG_SPI_MASTER is not set= : > drivers/iio/dac/ad5064.c:137: warning: =E2=80=98ad5064_spi_write=E2=80= =99 defined but not used >=20 > Reported-by: Randy Dunlap <rdunlap@xenotime.net> > Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> merged to fixes-togreg and pull request sent. > --- > drivers/iio/dac/ad5064.c | 38 +++++++++++++++++++------------------- > 1 file changed, 19 insertions(+), 19 deletions(-) >=20 > diff --git a/drivers/iio/dac/ad5064.c b/drivers/iio/dac/ad5064.c > index aa739c4..de2c368 100644 > --- a/drivers/iio/dac/ad5064.c > +++ b/drivers/iio/dac/ad5064.c > @@ -122,25 +122,6 @@ enum ad5064_type { > ID_AD5668_2, > }; > =20 > -static int ad5064_i2c_write(struct ad5064_state *st, unsigned int cmd, > - unsigned int addr, unsigned int val) > -{ > - struct i2c_client *i2c =3D to_i2c_client(st->dev); > - > - st->data.i2c[0] =3D (cmd << 4) | addr; > - put_unaligned_be16(val, &st->data.i2c[1]); > - return i2c_master_send(i2c, st->data.i2c, 3); > -} > - > -static int ad5064_spi_write(struct ad5064_state *st, unsigned int cmd, > - unsigned int addr, unsigned int val) > -{ > - struct spi_device *spi =3D to_spi_device(st->dev); > - > - st->data.spi =3D cpu_to_be32(AD5064_CMD(cmd) | AD5064_ADDR(addr) | va= l); > - return spi_write(spi, &st->data.spi, sizeof(st->data.spi)); > -} > - > static int ad5064_write(struct ad5064_state *st, unsigned int cmd, > unsigned int addr, unsigned int val, unsigned int shift) > { > @@ -533,6 +514,15 @@ static int __devexit ad5064_remove(struct device *= dev) > =20 > #if IS_ENABLED(CONFIG_SPI_MASTER) > =20 > +static int ad5064_spi_write(struct ad5064_state *st, unsigned int cmd, > + unsigned int addr, unsigned int val) > +{ > + struct spi_device *spi =3D to_spi_device(st->dev); > + > + st->data.spi =3D cpu_to_be32(AD5064_CMD(cmd) | AD5064_ADDR(addr) | va= l); > + return spi_write(spi, &st->data.spi, sizeof(st->data.spi)); > +} > + > static int __devinit ad5064_spi_probe(struct spi_device *spi) > { > const struct spi_device_id *id =3D spi_get_device_id(spi); > @@ -596,6 +586,16 @@ static inline void ad5064_spi_unregister_driver(vo= id) { } > =20 > #if IS_ENABLED(CONFIG_I2C) > =20 > +static int ad5064_i2c_write(struct ad5064_state *st, unsigned int cmd, > + unsigned int addr, unsigned int val) > +{ > + struct i2c_client *i2c =3D to_i2c_client(st->dev); > + > + st->data.i2c[0] =3D (cmd << 4) | addr; > + put_unaligned_be16(val, &st->data.i2c[1]); > + return i2c_master_send(i2c, st->data.i2c, 3); > +} > + > static int __devinit ad5064_i2c_probe(struct i2c_client *i2c, > const struct i2c_device_id *id) > { >=20 ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-07-12 19:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20120710174320.3b7dd806e20ee74ca1b1685f@canb.auug.org.au>
2012-07-11 5:51 ` linux-next: Tree for July 10 (iio) Randy Dunlap
2012-07-11 8:01 ` [PATCH] iio: ad5064: Move bus write callbacks to #if protected sections Lars-Peter Clausen
2012-07-12 19:22 ` Jonathan Cameron
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).