RE: [PATCH 04/19] staging: comedi: adl_pci6208: document the register map of the device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

On Thursday, June 28, 2012 12:06 PM, Dan Carpenter wrote:
> On Wed, Jun 27, 2012 at 02:56:43PM -0700, H Hartley Sweeten wrote:
>> Add defines for the register map of the device. These will be
>> used to clarify the code.
>> Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
>> Cc: Ian Abbott <abbotti@xxxxxxxxx>
>> Cc: Frank Mori Hess <fmhess@xxxxxxxxxxxxxxxxxxxxx>
>> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
>> ---
>>  drivers/staging/comedi/drivers/adl_pci6208.c | 12 ++++++++++++
>>  1 file changed, 12 insertions(+)
>> diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c
>> index f949d20..b6a8439 100644
>> --- a/drivers/staging/comedi/drivers/adl_pci6208.c
>> +++ b/drivers/staging/comedi/drivers/adl_pci6208.c
>> @@ -53,6 +53,18 @@ References:
>>   */
>>  #include "../comedidev.h"
>> +/*
>> + * PCI-6208/6216-GL register map
>> + */
>> +#define PCI6208_AO_CONTROL(x)		(0x00 + (2 * (x)))
>> +#define PCI6208_AO_STATUS		0x00
>> +#define PCI6208_AO_STATUS_DATA_SEND	(1 << 0)
>> +#define PCI6208_DIO			0x40
>> +#define PCI6208_DIO_DO_MASK		(0x0f)
>> +#define PCI6208_DIO_DO_SHIFT		(0)
>> +#define PCI6208_DIO_DI_MASK		(0xf0)
>> +#define PCI6208_DIO_DI_SHIFT		(4)
> This series is nice and I'm not nacking anything, but really is it
> that useful to say:
> 	status = inw(dev->iobase + PCI6208_AO_STATUS);
> instead of just?:
> 	status = inw(dev->iobase);

Either would work.

But the '+ PCI6208_AO_STATUS' used in the function makes it
easily apparent that the 'status' register is being read without
having to go back and see what the assumed '+ 0' register is.

> I'm not sure what the 0x00 in PCI6208_AO_CONTROL represents.  Some
> of these are not used like PCI6208_DIO_DI_SHIFT.

Sorry about that. Maybe there should be a comment.

The PCI-6208 has 8 separate "control" registers, one for each DAC output
(the PCI-6216 has 16). They are at offsets 0x00, 0x02, 0x04, ... 0x0e (0x1e for
The PCI-6216). The PCI6208_AO_CONTROL macro is used to calculate the
necessary offset based on the DAC channel. The original code used the
same open-coded logic.

The unused ones can be removed. When I created the patch that added
them I just added everything that might be useful from the manual for
the PCI-6208. I was quite sure what ones would end up un used.

> Does complain if you leave off these parenthesis?  If
> so I will complain again to the people.  Extra
> parenthesis are silly and there not used consistently.  Only
> paranthesis.

No, does not complain about the parenthesis either way.
I usually use the parenthesis in the 'bit' defines and not for the 'register'
defines. It helps my brain keep them separate... ;-)

But, they can be removed it needed.

> Again, I'm fine with this patch and the whole series.  These are
> just comments.

Thanks for the comments!

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at

[Other Archives]     [Linux Kernel Newbies]     [Linux Driver Development]     [Linux Kbuild]     [Fedora Kernel]     [Linux Kernel Testers]     [Linux SH]     [Linux Omap]     [Linux Tape]     [Linux Input]     [Linux Kernel Janitors]     [Linux Kernel Packagers]     [Linux Doc]     [Linux Man Pages]     [Linux API]     [Linux Memory Management]     [Linux Modules]     [Linux Standards]     [Kernel Announce]     [Netdev]     [Git]     [Linux PCI]     Linux CAN Development     [Linux I2C]     [Linux RDMA]     [Linux NUMA]     [Netfilter]     [Netfilter Devel]     [SELinux]     [Bugtraq]     [FIO]     [Linux Perf Users]     [Linux Serial]     [Linux PPP]     [Linux ISDN]     [Linux Next]     [Kernel Stable Commits]     [Linux Tip Commits]     [Kernel MM Commits]     [Linux Security Module]     [AutoFS]     [Filesystem Development]     [Ext3 Filesystem]     [Linux bcache]     [Ext4 Filesystem]     [Linux BTRFS]     [Linux CEPH Filesystem]     [Linux XFS]     [XFS]     [Linux NFS]     [Linux CIFS]     [Ecryptfs]     [Linux NILFS]     [Linux Cachefs]     [Reiser FS]     [Initramfs]     [Linux FB Devel]     [Linux OpenGL]     [DRI Devel]     [Fastboot]     [Linux RT Users]     [Linux RT Stable]     [eCos]     [Corosync]     [Linux Clusters]     [LVS Devel]     [Hot Plug]     [Linux Virtualization]     [KVM]     [KVM PPC]     [KVM ia64]     [Linux Containers]     [Linux Hexagon]     [Linux Cgroups]     [Util Linux]     [Wireless]     [Linux Bluetooth]     [Bluez Devel]     [Ethernet Bridging]     [Embedded Linux]     [Barebox]     [Linux MMC]     [Linux IIO]     [Sparse]     [Smatch]     [Linux Arch]     [x86 Platform Driver]     [Linux ACPI]     [Linux IBM ACPI]     [LM Sensors]     [CPU Freq]     [Linux Power Management]     [Linmodems]     [Linux DCCP]     [Linux SCTP]     [ALSA Devel]     [Linux USB]     [Linux PA RISC]     [Linux Samsung SOC]     [MIPS Linux]     [IBM S/390 Linux]     [ARM Linux]     [ARM Kernel]     [ARM MSM]     [Tegra Devel]     [Sparc Linux]     [Linux Security]     [Linux Sound]     [Linux Media]     [Video 4 Linux]     [Linux IRDA Users]     [Linux for the blind]     [Linux RAID]     [Linux ATA RAID]     [Device Mapper]     [Linux SCSI]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Linux IDE]     [Linux SMP]     [Linux AXP]     [Linux Alpha]     [Linux M68K]     [Linux ia64]     [Linux 8086]     [Linux x86_64]     [Linux Config]     [Linux Apps]     [Linux MSDOS]     [Linux X.25]     [Linux Crypto]     [DM Crypt]     [Linux Trace Users]     [Linux Btrace]     [Linux Watchdog]     [Utrace Devel]     [Linux C Programming]     [Linux Assembly]     [Dash]     [DWARVES]     [Hail Devel]     [Linux Kernel Debugger]     [Linux gcc]     [Gcc Help]     [X.Org]     [Wine]

Add to Google Powered by Linux

[Older Kernel Discussion]     [Yosemite National Park Forum]     [Large Format Photos]     [Gimp]     [Yosemite Photos]     [Stuff]