[PATCH 08/15] staging: comedi: addi_apci_3501: rename private data 'i_IobaseAmcc'

Ian Abbott abbotti at mev.co.uk
Thu Aug 13 10:54:17 UTC 2015


On 12/08/15 21:25, H Hartley Sweeten wrote:
> Rename this CamelCase member of the private data.
>
> Also, fix the type of the member, it holds a pci_resource_start()
> address and should be an unsigned long.

An 'int' or 'unsigned int' is fine in this case*, but 'unsigned long' is 
consistent with other usage of 'unsigned long' for I/O base addresses in 
this driver.

[*] pci_resource_start() returns a 'resource_size_t', but we're only 
concerned with PCI I/O space resources here, and those are limited to 32 
bits by the PCI specs (or 16 bits in actual practice for x86 compatibility).

>
> Signed-off-by: H Hartley Sweeten <hsweeten at visionengravers.com>
> Cc: Ian Abbott <abbotti at mev.co.uk>
> Cc: Greg Kroah-Hartman <gregkh at linxfoundation.org>
> ---
>   drivers/staging/comedi/drivers/addi_apci_3501.c | 15 +++++++--------
>   1 file changed, 7 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/staging/comedi/drivers/addi_apci_3501.c b/drivers/staging/comedi/drivers/addi_apci_3501.c
> index 6dd7e3d..c3a1acd 100644
> --- a/drivers/staging/comedi/drivers/addi_apci_3501.c
> +++ b/drivers/staging/comedi/drivers/addi_apci_3501.c
> @@ -72,7 +72,7 @@
>   #define EEPROM_TIMER_WATCHDOG_COUNTER	10
>
>   struct apci3501_private {
> -	int i_IobaseAmcc;
> +	unsigned long amcc;
>   	struct task_struct *tsk_Current;
>   	unsigned char timer_mode;
>   };
> @@ -222,11 +222,10 @@ static unsigned short apci3501_eeprom_readw(unsigned long iobase,
>   static int apci3501_eeprom_get_ao_n_chan(struct comedi_device *dev)
>   {
>   	struct apci3501_private *devpriv = dev->private;
> -	unsigned long iobase = devpriv->i_IobaseAmcc;
>   	unsigned char nfuncs;
>   	int i;
>
> -	nfuncs = apci3501_eeprom_readw(iobase, 10) & 0xff;
> +	nfuncs = apci3501_eeprom_readw(devpriv->amcc, 10) & 0xff;
>
>   	/* Read functionality details */
>   	for (i = 0; i < nfuncs; i++) {
> @@ -235,11 +234,11 @@ static int apci3501_eeprom_get_ao_n_chan(struct comedi_device *dev)
>   		unsigned char func;
>   		unsigned short val;
>
> -		func = apci3501_eeprom_readw(iobase, 12 + offset) & 0x3f;
> -		addr = apci3501_eeprom_readw(iobase, 14 + offset);
> +		func = apci3501_eeprom_readw(devpriv->amcc, 12 + offset) & 0x3f;
> +		addr = apci3501_eeprom_readw(devpriv->amcc, 14 + offset);
>
>   		if (func == EEPROM_ANALOGOUTPUT) {
> -			val = apci3501_eeprom_readw(iobase, addr + 10);
> +			val = apci3501_eeprom_readw(devpriv->amcc, addr + 10);
>   			return (val >> 4) & 0x3ff;
>   		}
>   	}
> @@ -254,7 +253,7 @@ static int apci3501_eeprom_insn_read(struct comedi_device *dev,
>   	struct apci3501_private *devpriv = dev->private;
>   	unsigned short addr = CR_CHAN(insn->chanspec);
>
> -	data[0] = apci3501_eeprom_readw(devpriv->i_IobaseAmcc, 2 * addr);
> +	data[0] = apci3501_eeprom_readw(devpriv->amcc, 2 * addr);
>
>   	return insn->n;
>   }
> @@ -335,7 +334,7 @@ static int apci3501_auto_attach(struct comedi_device *dev,
>   		return ret;
>
>   	dev->iobase = pci_resource_start(pcidev, 1);
> -	devpriv->i_IobaseAmcc = pci_resource_start(pcidev, 0);
> +	devpriv->amcc = pci_resource_start(pcidev, 0);
>
>   	ao_n_chan = apci3501_eeprom_get_ao_n_chan(dev);
>
>


-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti at mev.co.uk> )=-
-=(                          Web: http://www.mev.co.uk/  )=-


More information about the devel mailing list