Linux IIO development
 help / color / mirror / Atom feed
* const members of struct iio_chan_spec?
@ 2011-06-30 14:04 Hennerich, Michael
  2011-06-30 14:58 ` Jonathan Cameron
  0 siblings, 1 reply; 4+ messages in thread
From: Hennerich, Michael @ 2011-06-30 14:04 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio@vger.kernel.org,
	Device-drivers-devel@blackfin.uclinux.org

Hi Jonathan,

static int ad7280_channel_init(struct ad7280_state *st)
{
        int dev, ch, cnt;

        st->channels =3D kzalloc(sizeof(*st->channels) *
                        ((st->slave_num + 1) * 12 + 1), GFP_KERNEL);
        if (st->channels =3D=3D NULL)
                return -ENOMEM;

        for (dev =3D 0, cnt =3D 0; dev <=3D st->slave_num; dev++)
                for (ch =3D AD7280A_CELL_VOLTAGE_1; ch <=3D AD7280A_AUX_ADC=
_6; ch++, cnt++) {
                        st->channels[cnt].type =3D IIO_IN;
                        st->channels[cnt].indexed =3D 1;
                        st->channels[cnt].extend_name =3D NULL;
                        st->channels[cnt].channel =3D cnt;
                        st->channels[cnt].info_mask =3D (1 << IIO_CHAN_INFO=
_SCALE_SHARED);
                        st->channels[cnt].address =3D dev << 8 | ch;
                        st->channels[cnt].scan_index =3D cnt;
                        st->channels[cnt].scan_type.sign =3D 'u';
                        st->channels[cnt].scan_type.realbits =3D 12;
                        st->channels[cnt].scan_type.storagebits =3D 32;
                        st->channels[cnt].scan_type.shift =3D 0;
                }
        return cnt;
}

Trying to dynamically allocate and populate a channel spec.
However some members are declared const. Do they really need to be const?

drivers/staging/iio/adc/ad7280a_core.c: In function 'ad7280_channel_init':
drivers/staging/iio/adc/ad7280a_core.c:231: error: assignment of read-only =
member 'info_mask'

Regards,
Michael

------------------------------------------------------------------
********* Analog Devices GmbH
**  *****
**     ** Wilhelm-Wagenfeld-Strasse 6
**  ***** D-80807 Munich
********* Germany
Sitz der Gesellschaft: Muenchen; Registergericht: Muenchen HRB 40368;
Geschaeftsfuehrer: Dr.Carsten Suckrow, Thomas Wessel, William A. Martin, Ma=
rgaret Seif

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-07-02  8:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-30 14:04 const members of struct iio_chan_spec? Hennerich, Michael
2011-06-30 14:58 ` Jonathan Cameron
2011-07-01 19:27   ` Hennerich, Michael
2011-07-02  8:35     ` jonathan.cameron@gmail.com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox