public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/30] staging: comedi: move 'struct pci_dev *' into comedi_device
@ 2012-07-11 21:47 H Hartley Sweeten
  2012-07-12  8:55 ` Ian Abbott
  0 siblings, 1 reply; 4+ messages in thread
From: H Hartley Sweeten @ 2012-07-11 21:47 UTC (permalink / raw)
  To: Linux Kernel; +Cc: devel, abbotti, gregkh

All the comedi pci drivers have a struct pci_dev * in their private
data to hold the pointer to the pci device. Some of the drivers only
have private data because of this pointer.

Move the variable into the comedi_device struct and remove the private
data for the drivers that no longer need it.

This only updates the drivers that have been cleaned up enough or only
need simple changes to make the conversion. The other comedi pci drivers
will be converted to use the common pci_dev pointer as they are cleaned
up.

The cb_pcidio and dyna_pci10xx drivers have a bit of additional cleanup
to remove some of the unneeded private data variables and to use the
comedi_device iobase variable.

H Hartley Sweeten (30):
  staging: comedi: add pci_dev pointer to comedi_device
  staging: comedi: adl_pci6208: use comedi_device pci_dev pointer
  staging: comedi: adl_pci7230: use comedi_device pci_dev pointer
  staging: comedi: adl_pci7230: remove private data
  staging: comedi: adl_pci7296: use comedi_device pci_dev pointer
  staging: comedi: adl_pci7296: remove private data
  staging: comedi: adl_pci7432: use comedi_device pci_dev pointer
  staging: comedi: adl_pci7432: remove private data
  staging: comedi: adl_pci8164: use comedi_device pci_dev pointer
  staging: comedi: adl_pci8164: remove private data
  staging: comedi: adl_pci9111: use comedi_device pci_dev pointer
  staging: comedi: adl_pci9118: use comedi_device pci_dev pointer
  staging: comedi: cb_pcidas: use comedi_device pci_dev pointer
  staging: comedi: cb_pcidio: factor out the "find pci device" code
  staging: comedi: cb_pcidio: cleanup the "find pci device" code
  staging: comedi: cb_pcidio: use comedi_device pci_dev pointer
  staging: comedi: cb_pcidio: use comedi_device iobase
  staging: comedi: cb_pcidio: remove private data
  staging: comedi: contec_pci_dio: factor out the "find pci device"
    code
  staging: comedi: contec_pci_dio: cleanup the "find pci device" code
  staging: comedi: contec_pci_dio: use comedi_device pci_dev pointer
  staging: comedi: contec_pci_dio: remove private data
  staging: comedi: dyna_pci10xx: factor out the "find pci device" code
  staging: comedi: dyna_pci10xx: cleanup the "find pci device" code
  staging: comedi: dyna_pci10xx: use comedi_device pci_dev pointer
  staging: comedi: dyna_pci10xx: remove unused variables in the private
    data
  staging: comedi: dyna_pci10xx: use comedi_device iobase
  staging: comedi: ke_counter: factor out the "find pci device" code
  staging: comedi: ke_counter: cleanup the "find pci device" code
  staging: comedi: contec_pci_dio: use comedi_device pci_dev pointer

 drivers/staging/comedi/comedidev.h              |   2 +
 drivers/staging/comedi/drivers/adl_pci6208.c    |  17 ++--
 drivers/staging/comedi/drivers/adl_pci7230.c    |  24 ++---
 drivers/staging/comedi/drivers/adl_pci7296.c    |  24 ++---
 drivers/staging/comedi/drivers/adl_pci7432.c    |  24 ++---
 drivers/staging/comedi/drivers/adl_pci8164.c    |  24 ++---
 drivers/staging/comedi/drivers/adl_pci9111.c    |  25 +++--
 drivers/staging/comedi/drivers/adl_pci9118.c    |  23 +++--
 drivers/staging/comedi/drivers/cb_pcidas.c      |  31 +++---
 drivers/staging/comedi/drivers/cb_pcidio.c      | 115 ++++++++---------------
 drivers/staging/comedi/drivers/contec_pci_dio.c | 119 +++++++++++------------
 drivers/staging/comedi/drivers/dyna_pci10xx.c   | 120 +++++++++---------------
 drivers/staging/comedi/drivers/ke_counter.c     | 108 +++++++++------------
 13 files changed, 258 insertions(+), 398 deletions(-)

-- 
1.7.11


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

* Re: [PATCH 00/30] staging: comedi: move 'struct pci_dev *' into comedi_device
  2012-07-11 21:47 [PATCH 00/30] staging: comedi: move 'struct pci_dev *' into comedi_device H Hartley Sweeten
@ 2012-07-12  8:55 ` Ian Abbott
  2012-07-12  9:02   ` Alan Cox
  0 siblings, 1 reply; 4+ messages in thread
From: Ian Abbott @ 2012-07-12  8:55 UTC (permalink / raw)
  To: H Hartley Sweeten
  Cc: Linux Kernel, devel@driverdev.osuosl.org, Ian Abbott,
	gregkh@linuxfoundation.org

On 2012/07/11 10:47 PM, H Hartley Sweeten wrote:
> All the comedi pci drivers have a struct pci_dev * in their private
> data to hold the pointer to the pci device. Some of the drivers only
> have private data because of this pointer.
> 
> Move the variable into the comedi_device struct and remove the private
> data for the drivers that no longer need it.

I suppose at a later date we could turn that into a union with a short
name like u (so comedidev->pcidev would become something like
comedidev->u.pcidev), which would allow us to stick a 'struct
usb_interface *' or some other hardware device wrapper struct pointer in
the same hole.  (Maybe 'h' for 'hardware' would be better than 'u'.)

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@mev.co.uk>             )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587              )=-

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

* Re: [PATCH 00/30] staging: comedi: move 'struct pci_dev *' into comedi_device
  2012-07-12  8:55 ` Ian Abbott
@ 2012-07-12  9:02   ` Alan Cox
  2012-07-12  9:02     ` Ian Abbott
  0 siblings, 1 reply; 4+ messages in thread
From: Alan Cox @ 2012-07-12  9:02 UTC (permalink / raw)
  To: Ian Abbott
  Cc: H Hartley Sweeten, Linux Kernel, devel@driverdev.osuosl.org,
	Ian Abbott, gregkh@linuxfoundation.org

> I suppose at a later date we could turn that into a union with a short
> name like u (so comedidev->pcidev would become something like
> comedidev->u.pcidev), which would allow us to stick a 'struct
> usb_interface *' or some other hardware device wrapper struct pointer in
> the same hole.  (Maybe 'h' for 'hardware' would be better than 'u'.)

The "usual" pattern is to make it a struct device pointer. Then you can
get to any other kind of device from it.

Alan
 

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

* Re: [PATCH 00/30] staging: comedi: move 'struct pci_dev *' into comedi_device
  2012-07-12  9:02   ` Alan Cox
@ 2012-07-12  9:02     ` Ian Abbott
  0 siblings, 0 replies; 4+ messages in thread
From: Ian Abbott @ 2012-07-12  9:02 UTC (permalink / raw)
  To: Alan Cox
  Cc: Ian Abbott, H Hartley Sweeten, Linux Kernel,
	devel@driverdev.osuosl.org, gregkh@linuxfoundation.org

On 2012/07/12 10:02 AM, Alan Cox wrote:
>> I suppose at a later date we could turn that into a union with a short
>> name like u (so comedidev->pcidev would become something like
>> comedidev->u.pcidev), which would allow us to stick a 'struct
>> usb_interface *' or some other hardware device wrapper struct pointer in
>> the same hole.  (Maybe 'h' for 'hardware' would be better than 'u'.)
> 
> The "usual" pattern is to make it a struct device pointer. Then you can
> get to any other kind of device from it.

You mean with container_of(), right?  Actually, 'struct comedi_device'
already has a little-used 'struct device *hw_dev' member that could be
used for this purpose.

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@mev.co.uk>             )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587              )=-

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

end of thread, other threads:[~2012-07-12  9:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-11 21:47 [PATCH 00/30] staging: comedi: move 'struct pci_dev *' into comedi_device H Hartley Sweeten
2012-07-12  8:55 ` Ian Abbott
2012-07-12  9:02   ` Alan Cox
2012-07-12  9:02     ` Ian Abbott

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