Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1504921

Re: [PATCH 2/4] iio: dpot-dac: DAC driver based on a digital potentiometer

From Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Newsgroups linux.kernel
Subject Re: [PATCH 2/4] iio: dpot-dac: DAC driver based on a digital potentiometer
Date 2016-10-20 16:10 +0200
Message-ID <sumcG-ed-19@gated-at.bofh.it> (permalink)
References <sujHP-6Ry-7@gated-at.bofh.it> <sujHP-6Ry-9@gated-at.bofh.it> <sujHP-6Ry-5@gated-at.bofh.it> <sumcG-ed-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


> >> +struct dpot_dac {
> >> +	struct regulator *vref;
> >> +	struct iio_channel *dpot;
> > 
> > const
> 
> const? devm_iio_channel_get doesn't return a const iio_channel. What
> am I missing?

ah, I mixed this up with iio_chan_spec
 
> >> +	u32 max_ohms;
> >> +};
> >> +
> >> +static const struct iio_chan_spec dpot_dac_iio_channel = {
> >> +	.type = IIO_VOLTAGE,
> >> +	.info_mask_separate = BIT(IIO_CHAN_INFO_RAW)
> >> +			    | BIT(IIO_CHAN_INFO_SCALE),
> >> +	.output = 1,
> >> +};
> >> +
> >> +static int dpot_dac_read_raw(struct iio_dev *indio_dev,
> >> +			     struct iio_chan_spec const *chan,
> >> +			     int *val, int *val2, long mask)
> >> +{
> >> +	struct dpot_dac *dac = iio_priv(indio_dev);
> >> +	int ret;
> >> +	unsigned long long tmp;
> > 
> > s64 (which is used to cast below)
> 
> I assume that what you really want is to get rid of the cast, and
> that you aren't really bothered if tmp is ull or s32, right? Given
> that assumption, I'm just dropping the cast instead. The LL specifier
> on the constant should promote *val anyway.

what I meant to pick upon was mixing
s64 with unsigned long long with LL in the code that follows

anything simpler and more consistent would be good

thanks, p.

-- 

Peter Meerwald-Stadler
+43-664-2444418 (mobile)

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: [PATCH 2/4] iio: dpot-dac: DAC driver based on a digital  potentiometer Peter Meerwald-Stadler <pmeerw@pmeerw.net> - 2016-10-20 13:30 +0200
  Re: [PATCH 2/4] iio: dpot-dac: DAC driver based on a digital  potentiometer Peter Meerwald-Stadler <pmeerw@pmeerw.net> - 2016-10-20 16:10 +0200

csiph-web