From 7f2f7e050bea242735880b7876d9771efb580213 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 15 Oct 2012 10:16:38 -0700 Subject: [PATCH] staging: comedi: s626: remove devpriv macro Missed one... This macro relies on a local variable having a specific name. Remove its use by replacing it with a local variable where used. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/s626.c | 40 +++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c index 551d68b7837c..511183da0eec 100644 --- a/drivers/staging/comedi/drivers/s626.c +++ b/drivers/staging/comedi/drivers/s626.c @@ -161,7 +161,6 @@ static struct dio_private *dio_private_word[]={ }; */ -#define devpriv ((struct s626_private *)dev->private) #define diopriv ((struct dio_private *)s->private) /* COUNTER OBJECT ------------------------------------------------ */ @@ -232,6 +231,8 @@ static const struct comedi_lrange s626_range_table = { 2, { /* critical section. */ static void DEBItransfer(struct comedi_device *dev) { + struct s626_private *devpriv = dev->private; + /* Initiate upload of shadow RAM to DEBI control register. */ MC_ENABLE(P_MC2, MC2_UPLD_DEBI); @@ -249,6 +250,7 @@ static void DEBItransfer(struct comedi_device *dev) static uint16_t DEBIread(struct comedi_device *dev, uint16_t addr) { + struct s626_private *devpriv = dev->private; uint16_t retval; /* Set up DEBI control register value in shadow RAM. */ @@ -267,6 +269,7 @@ static uint16_t DEBIread(struct comedi_device *dev, uint16_t addr) /* Write a value to a gate array register. */ static void DEBIwrite(struct comedi_device *dev, uint16_t addr, uint16_t wdata) { + struct s626_private *devpriv = dev->private; /* Set up DEBI control register value in shadow RAM. */ WR7146(P_DEBICMD, DEBI_CMD_WRWORD | addr); @@ -283,6 +286,7 @@ static void DEBIwrite(struct comedi_device *dev, uint16_t addr, uint16_t wdata) static void DEBIreplace(struct comedi_device *dev, uint16_t addr, uint16_t mask, uint16_t wdata) { + struct s626_private *devpriv = dev->private; /* Copy target gate array register into P_DEBIAD register. */ WR7146(P_DEBICMD, DEBI_CMD_RDWORD | addr); @@ -302,6 +306,8 @@ static void DEBIreplace(struct comedi_device *dev, uint16_t addr, uint16_t mask, static uint32_t I2Chandshake(struct comedi_device *dev, uint32_t val) { + struct s626_private *devpriv = dev->private; + /* Write I2C command to I2C Transfer Control shadow register. */ WR7146(P_I2CCTRL, val); @@ -324,6 +330,7 @@ static uint32_t I2Chandshake(struct comedi_device *dev, uint32_t val) /* Read uint8_t from EEPROM. */ static uint8_t I2Cread(struct comedi_device *dev, uint8_t addr) { + struct s626_private *devpriv = dev->private; uint8_t rtnval; /* Send EEPROM target address. */ @@ -375,6 +382,7 @@ static uint8_t trimadrs[] = { 0x40, 0x41, 0x42, 0x50, 0x51, 0x52, 0x53, 0x60, 0x */ static void SendDAC(struct comedi_device *dev, uint32_t val) { + struct s626_private *devpriv = dev->private; /* START THE SERIAL CLOCK RUNNING ------------- */ @@ -496,6 +504,7 @@ static void SendDAC(struct comedi_device *dev, uint32_t val) /* Private helper function: Write setpoint to an application DAC channel. */ static void SetDAC(struct comedi_device *dev, uint16_t chan, short dacdata) { + struct s626_private *devpriv = dev->private; register uint16_t signmask; register uint32_t WSImage; @@ -553,6 +562,7 @@ static void SetDAC(struct comedi_device *dev, uint16_t chan, short dacdata) static void WriteTrimDAC(struct comedi_device *dev, uint8_t LogicalChan, uint8_t DacData) { + struct s626_private *devpriv = dev->private; uint32_t chan; /* Save the new setpoint in case the application needs to read it back later. */ @@ -735,6 +745,7 @@ static int s626_dio_clear_irq(struct comedi_device *dev) static irqreturn_t s626_irq_handler(int irq, void *d) { struct comedi_device *dev = d; + struct s626_private *devpriv = dev->private; struct comedi_subdevice *s; struct comedi_cmd *cmd; struct enc_private *k; @@ -968,6 +979,7 @@ static irqreturn_t s626_irq_handler(int irq, void *d) */ static void ResetADC(struct comedi_device *dev, uint8_t *ppl) { + struct s626_private *devpriv = dev->private; register uint32_t *pRPS; uint32_t JmpAdrs; uint16_t i; @@ -1163,6 +1175,7 @@ static int s626_ai_insn_config(struct comedi_device *dev, /* static int s626_ai_rinsn(struct comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data) */ /* { */ +/* struct s626_private *devpriv = dev->private; */ /* register uint8_t i; */ /* register int32_t *readaddr; */ @@ -1191,6 +1204,7 @@ static int s626_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct s626_private *devpriv = dev->private; uint16_t chan = CR_CHAN(insn->chanspec); uint16_t range = CR_RANGE(insn->chanspec); uint16_t AdcSpec = 0; @@ -1302,6 +1316,8 @@ static int s626_ai_load_polllist(uint8_t *ppl, struct comedi_cmd *cmd) static int s626_ai_inttrig(struct comedi_device *dev, struct comedi_subdevice *s, unsigned int trignum) { + struct s626_private *devpriv = dev->private; + if (trignum != 0) return -EINVAL; @@ -1378,7 +1394,7 @@ static void s626_timer_load(struct comedi_device *dev, struct enc_private *k, /* TO COMPLETE */ static int s626_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) { - + struct s626_private *devpriv = dev->private; uint8_t ppl[16]; struct comedi_cmd *cmd = &s->async->cmd; struct enc_private *k; @@ -1643,6 +1659,8 @@ static int s626_ai_cmdtest(struct comedi_device *dev, static int s626_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) { + struct s626_private *devpriv = dev->private; + /* Stop RPS program in case it is currently running. */ MC_DISABLE(P_MC1, MC1_ERPS1); @@ -1657,7 +1675,7 @@ static int s626_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) static int s626_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - + struct s626_private *devpriv = dev->private; int i; uint16_t chan = CR_CHAN(insn->chanspec); int16_t dacdata; @@ -1676,6 +1694,7 @@ static int s626_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s, static int s626_ao_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { + struct s626_private *devpriv = dev->private; int i; for (i = 0; i < insn->n; i++) @@ -1974,6 +1993,7 @@ static uint16_t GetMode_B(struct comedi_device *dev, struct enc_private *k) static void SetMode_A(struct comedi_device *dev, struct enc_private *k, uint16_t Setup, uint16_t DisableIntSrc) { + struct s626_private *devpriv = dev->private; register uint16_t cra; register uint16_t crb; register uint16_t setup = Setup; /* Cache the Standard Setup. */ @@ -2032,6 +2052,7 @@ static void SetMode_A(struct comedi_device *dev, struct enc_private *k, static void SetMode_B(struct comedi_device *dev, struct enc_private *k, uint16_t Setup, uint16_t DisableIntSrc) { + struct s626_private *devpriv = dev->private; register uint16_t cra; register uint16_t crb; register uint16_t setup = Setup; /* Cache the Standard Setup. */ @@ -2165,6 +2186,8 @@ static uint16_t GetLoadTrig_B(struct comedi_device *dev, struct enc_private *k) static void SetIntSrc_A(struct comedi_device *dev, struct enc_private *k, uint16_t IntSource) { + struct s626_private *devpriv = dev->private; + /* Reset any pending counter overflow or index captures. */ DEBIreplace(dev, k->MyCRB, (uint16_t) (~CRBMSK_INTCTRL), CRBMSK_INTRESETCMD | CRBMSK_INTRESET_A); @@ -2182,6 +2205,7 @@ static void SetIntSrc_A(struct comedi_device *dev, struct enc_private *k, static void SetIntSrc_B(struct comedi_device *dev, struct enc_private *k, uint16_t IntSource) { + struct s626_private *devpriv = dev->private; uint16_t crb; /* Cache writeable CRB register image. */ @@ -2412,6 +2436,7 @@ static void CountersInit(struct comedi_device *dev) static int s626_allocate_dma_buffers(struct comedi_device *dev) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); + struct s626_private *devpriv = dev->private; void *addr; dma_addr_t appdma; @@ -2432,6 +2457,7 @@ static int s626_allocate_dma_buffers(struct comedi_device *dev) static void s626_initialize(struct comedi_device *dev) { + struct s626_private *devpriv = dev->private; dma_addr_t pPhysBuf; uint16_t chan; int i; @@ -2667,14 +2693,17 @@ static void s626_initialize(struct comedi_device *dev) static int s626_attach_pci(struct comedi_device *dev, struct pci_dev *pcidev) { + struct s626_private *devpriv; struct comedi_subdevice *s; int ret; comedi_set_hw_dev(dev, &pcidev->dev); dev->board_name = dev->driver->driver_name; - if (alloc_private(dev, sizeof(struct s626_private)) < 0) - return -ENOMEM; + ret = alloc_private(dev, sizeof(*devpriv)); + if (ret) + return ret; + devpriv = dev->private; ret = comedi_pci_enable(pcidev, dev->board_name); if (ret) @@ -2794,6 +2823,7 @@ static int s626_attach_pci(struct comedi_device *dev, struct pci_dev *pcidev) static void s626_detach(struct comedi_device *dev) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); + struct s626_private *devpriv = dev->private; if (devpriv) { /* stop ai_command */ -- 2.39.5