From mboxrd@z Thu Jan 1 00:00:00 1970 From: maxime.ripard@free-electrons.com (Maxime Ripard) Date: Fri, 04 Nov 2011 16:22:02 +0100 Subject: [PATCH 1/3] ARM: AT91: Add platform data for the ADCs In-Reply-To: <4EB3BFD2.5080909@jic23.retrosnub.co.uk> References: <1319041134-19712-1-git-send-email-maxime.ripard@free-electrons.com> <1320315070-1700-1-git-send-email-maxime.ripard@free-electrons.com> <1320315070-1700-2-git-send-email-maxime.ripard@free-electrons.com> <4EB3BFD2.5080909@jic23.retrosnub.co.uk> Message-ID: <4EB4031A.4080806@free-electrons.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Hi Jonathan, On 04/11/2011 11:34, Jonathan Cameron wrote: > On 11/03/2011 10:11 AM, Maxime Ripard wrote: >> +/* ADC */ >> +#define AT91_ADC_MAX_CHANNELS 16 >> + >> +struct at91_adc_data { >> + /* ADC Clock as specified by the datasheet, in Hz. */ >> + unsigned int adc_clock; >> + /* >> + * Global number of channels available (to specify which channels are >> + * indeed used on the board, see the channels_used array). >> + */ >> + u8 num_channels; >> + /* Channels in use on the board */ > put it in a unsigned long and use the bitmap functions. >> + u8 channels_used[AT91_ADC_MAX_CHANNELS]; >> + /* Number of channels in use */ > just use bitmap_weight with the long above and > length set to num_channels. >> + u8 num_channels_used; I didn't know bitmap functions before you mentioned it, but if I read it correctly, while I agree with your point, I will lose the ability to define a combination of enabled and disabled channel in a board specific manner. In the third patch, I defined channels_used as an array of one. But let's say that instead I want all channels except the second one. With what's in the driver for now, I initialise it to {1, 0, 1, 1}. I don't think it's possible to do so with bitmap functions, or am I missing something ? Or put the calls to bitmap_set in the board_init function ? -- Maxime Ripard, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com