summaryrefslogtreecommitdiffstats
path: root/drivers/vme
diff options
context:
space:
mode:
authorAaron Sierra <asierra@xes-inc.com>2016-04-29 17:41:02 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-08-31 07:20:15 -0400
commitfa54b326803d91b04705a6adf0ff963593a9fe5c (patch)
tree98f6c8d87031facf1ccb9adf734d9962d21a86fb /drivers/vme
parent655745b0d1ebeceb0453f1c6adca154a4fac0ad5 (diff)
vme: change LM callback argument to void pointer
Make the location monitor callback function prototype more useful by changing the argument from an integer to a void pointer. All VME bridge drivers were simply passing the location monitor index (e.g. 0-3) as the argument to these callbacks. It is much more useful to pass back a pointer to data that the callback-registering driver cares about. There appear to be no in-kernel callers of vme_lm_attach (or vme_lme_request for that matter), so this change only affects the VME subsystem and bridge drivers. This has been tested with Tsi148 hardware, but the CA91Cx42 changes have only been compiled. Signed-off-by: Aaron Sierra <asierra@xes-inc.com> Acked-by: Martyn Welch <martyn@welchs.me.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/vme')
-rw-r--r--drivers/vme/bridges/vme_ca91cx42.c6
-rw-r--r--drivers/vme/bridges/vme_ca91cx42.h3
-rw-r--r--drivers/vme/bridges/vme_tsi148.c6
-rw-r--r--drivers/vme/bridges/vme_tsi148.h3
-rw-r--r--drivers/vme/vme.c4
-rw-r--r--drivers/vme/vme_bridge.h3
6 files changed, 16 insertions, 9 deletions
diff --git a/drivers/vme/bridges/vme_ca91cx42.c b/drivers/vme/bridges/vme_ca91cx42.c
index 9f2c834e43e0..da29dbe6c9c8 100644
--- a/drivers/vme/bridges/vme_ca91cx42.c
+++ b/drivers/vme/bridges/vme_ca91cx42.c
@@ -69,7 +69,7 @@ static u32 ca91cx42_LM_irqhandler(struct ca91cx42_driver *bridge, u32 stat)
69 for (i = 0; i < 4; i++) { 69 for (i = 0; i < 4; i++) {
70 if (stat & CA91CX42_LINT_LM[i]) { 70 if (stat & CA91CX42_LINT_LM[i]) {
71 /* We only enable interrupts if the callback is set */ 71 /* We only enable interrupts if the callback is set */
72 bridge->lm_callback[i](i); 72 bridge->lm_callback[i](bridge->lm_data[i]);
73 serviced |= CA91CX42_LINT_LM[i]; 73 serviced |= CA91CX42_LINT_LM[i];
74 } 74 }
75 } 75 }
@@ -1410,7 +1410,7 @@ static int ca91cx42_lm_get(struct vme_lm_resource *lm,
1410 * Callback will be passed the monitor triggered. 1410 * Callback will be passed the monitor triggered.
1411 */ 1411 */
1412static int ca91cx42_lm_attach(struct vme_lm_resource *lm, int monitor, 1412static int ca91cx42_lm_attach(struct vme_lm_resource *lm, int monitor,
1413 void (*callback)(int)) 1413 void (*callback)(void *), void *data)
1414{ 1414{
1415 u32 lm_ctl, tmp; 1415 u32 lm_ctl, tmp;
1416 struct ca91cx42_driver *bridge; 1416 struct ca91cx42_driver *bridge;
@@ -1438,6 +1438,7 @@ static int ca91cx42_lm_attach(struct vme_lm_resource *lm, int monitor,
1438 1438
1439 /* Attach callback */ 1439 /* Attach callback */
1440 bridge->lm_callback[monitor] = callback; 1440 bridge->lm_callback[monitor] = callback;
1441 bridge->lm_data[monitor] = data;
1441 1442
1442 /* Enable Location Monitor interrupt */ 1443 /* Enable Location Monitor interrupt */
1443 tmp = ioread32(bridge->base + LINT_EN); 1444 tmp = ioread32(bridge->base + LINT_EN);
@@ -1477,6 +1478,7 @@ static int ca91cx42_lm_detach(struct vme_lm_resource *lm, int monitor)
1477 1478
1478 /* Detach callback */ 1479 /* Detach callback */
1479 bridge->lm_callback[monitor] = NULL; 1480 bridge->lm_callback[monitor] = NULL;
1481 bridge->lm_data[monitor] = NULL;
1480 1482
1481 /* If all location monitors disabled, disable global Location Monitor */ 1483 /* If all location monitors disabled, disable global Location Monitor */
1482 if ((tmp & (CA91CX42_LINT_LM0 | CA91CX42_LINT_LM1 | CA91CX42_LINT_LM2 | 1484 if ((tmp & (CA91CX42_LINT_LM0 | CA91CX42_LINT_LM1 | CA91CX42_LINT_LM2 |
diff --git a/drivers/vme/bridges/vme_ca91cx42.h b/drivers/vme/bridges/vme_ca91cx42.h
index d54119e59d55..f35c9f5348a9 100644
--- a/drivers/vme/bridges/vme_ca91cx42.h
+++ b/drivers/vme/bridges/vme_ca91cx42.h
@@ -43,7 +43,8 @@ struct ca91cx42_driver {
43 wait_queue_head_t dma_queue; 43 wait_queue_head_t dma_queue;
44 wait_queue_head_t iack_queue; 44 wait_queue_head_t iack_queue;
45 wait_queue_head_t mbox_queue; 45 wait_queue_head_t mbox_queue;
46 void (*lm_callback[4])(int); /* Called in interrupt handler */ 46 void (*lm_callback[4])(void *); /* Called in interrupt handler */
47 void *lm_data[4];
47 void *crcsr_kernel; 48 void *crcsr_kernel;
48 dma_addr_t crcsr_bus; 49 dma_addr_t crcsr_bus;
49 struct mutex vme_rmw; /* Only one RMW cycle at a time */ 50 struct mutex vme_rmw; /* Only one RMW cycle at a time */
diff --git a/drivers/vme/bridges/vme_tsi148.c b/drivers/vme/bridges/vme_tsi148.c
index 4bc5d451ec6c..2d3ba1a1d42d 100644
--- a/drivers/vme/bridges/vme_tsi148.c
+++ b/drivers/vme/bridges/vme_tsi148.c
@@ -102,7 +102,7 @@ static u32 tsi148_LM_irqhandler(struct tsi148_driver *bridge, u32 stat)
102 for (i = 0; i < 4; i++) { 102 for (i = 0; i < 4; i++) {
103 if (stat & TSI148_LCSR_INTS_LMS[i]) { 103 if (stat & TSI148_LCSR_INTS_LMS[i]) {
104 /* We only enable interrupts if the callback is set */ 104 /* We only enable interrupts if the callback is set */
105 bridge->lm_callback[i](i); 105 bridge->lm_callback[i](bridge->lm_data[i]);
106 serviced |= TSI148_LCSR_INTC_LMC[i]; 106 serviced |= TSI148_LCSR_INTC_LMC[i];
107 } 107 }
108 } 108 }
@@ -2047,7 +2047,7 @@ static int tsi148_lm_get(struct vme_lm_resource *lm,
2047 * Callback will be passed the monitor triggered. 2047 * Callback will be passed the monitor triggered.
2048 */ 2048 */
2049static int tsi148_lm_attach(struct vme_lm_resource *lm, int monitor, 2049static int tsi148_lm_attach(struct vme_lm_resource *lm, int monitor,
2050 void (*callback)(int)) 2050 void (*callback)(void *), void *data)
2051{ 2051{
2052 u32 lm_ctl, tmp; 2052 u32 lm_ctl, tmp;
2053 struct vme_bridge *tsi148_bridge; 2053 struct vme_bridge *tsi148_bridge;
@@ -2077,6 +2077,7 @@ static int tsi148_lm_attach(struct vme_lm_resource *lm, int monitor,
2077 2077
2078 /* Attach callback */ 2078 /* Attach callback */
2079 bridge->lm_callback[monitor] = callback; 2079 bridge->lm_callback[monitor] = callback;
2080 bridge->lm_data[monitor] = data;
2080 2081
2081 /* Enable Location Monitor interrupt */ 2082 /* Enable Location Monitor interrupt */
2082 tmp = ioread32be(bridge->base + TSI148_LCSR_INTEN); 2083 tmp = ioread32be(bridge->base + TSI148_LCSR_INTEN);
@@ -2124,6 +2125,7 @@ static int tsi148_lm_detach(struct vme_lm_resource *lm, int monitor)
2124 2125
2125 /* Detach callback */ 2126 /* Detach callback */
2126 bridge->lm_callback[monitor] = NULL; 2127 bridge->lm_callback[monitor] = NULL;
2128 bridge->lm_data[monitor] = NULL;
2127 2129
2128 /* If all location monitors disabled, disable global Location Monitor */ 2130 /* If all location monitors disabled, disable global Location Monitor */
2129 if ((lm_en & (TSI148_LCSR_INTS_LM0S | TSI148_LCSR_INTS_LM1S | 2131 if ((lm_en & (TSI148_LCSR_INTS_LM0S | TSI148_LCSR_INTS_LM1S |
diff --git a/drivers/vme/bridges/vme_tsi148.h b/drivers/vme/bridges/vme_tsi148.h
index f5ed14382a8d..0935d85d32ec 100644
--- a/drivers/vme/bridges/vme_tsi148.h
+++ b/drivers/vme/bridges/vme_tsi148.h
@@ -38,7 +38,8 @@ struct tsi148_driver {
38 void __iomem *base; /* Base Address of device registers */ 38 void __iomem *base; /* Base Address of device registers */
39 wait_queue_head_t dma_queue[2]; 39 wait_queue_head_t dma_queue[2];
40 wait_queue_head_t iack_queue; 40 wait_queue_head_t iack_queue;
41 void (*lm_callback[4])(int); /* Called in interrupt handler */ 41 void (*lm_callback[4])(void *); /* Called in interrupt handler */
42 void *lm_data[4];
42 void *crcsr_kernel; 43 void *crcsr_kernel;
43 dma_addr_t crcsr_bus; 44 dma_addr_t crcsr_bus;
44 struct vme_master_resource *flush_image; 45 struct vme_master_resource *flush_image;
diff --git a/drivers/vme/vme.c b/drivers/vme/vme.c
index 37ac0a58e59a..4693b7bd3364 100644
--- a/drivers/vme/vme.c
+++ b/drivers/vme/vme.c
@@ -1321,7 +1321,7 @@ int vme_lm_get(struct vme_resource *resource, unsigned long long *lm_base,
1321EXPORT_SYMBOL(vme_lm_get); 1321EXPORT_SYMBOL(vme_lm_get);
1322 1322
1323int vme_lm_attach(struct vme_resource *resource, int monitor, 1323int vme_lm_attach(struct vme_resource *resource, int monitor,
1324 void (*callback)(int)) 1324 void (*callback)(void *), void *data)
1325{ 1325{
1326 struct vme_bridge *bridge = find_bridge(resource); 1326 struct vme_bridge *bridge = find_bridge(resource);
1327 struct vme_lm_resource *lm; 1327 struct vme_lm_resource *lm;
@@ -1338,7 +1338,7 @@ int vme_lm_attach(struct vme_resource *resource, int monitor,
1338 return -EINVAL; 1338 return -EINVAL;
1339 } 1339 }
1340 1340
1341 return bridge->lm_attach(lm, monitor, callback); 1341 return bridge->lm_attach(lm, monitor, callback, data);
1342} 1342}
1343EXPORT_SYMBOL(vme_lm_attach); 1343EXPORT_SYMBOL(vme_lm_attach);
1344 1344
diff --git a/drivers/vme/vme_bridge.h b/drivers/vme/vme_bridge.h
index cb8246fd97be..2662e916b96a 100644
--- a/drivers/vme/vme_bridge.h
+++ b/drivers/vme/vme_bridge.h
@@ -160,7 +160,8 @@ struct vme_bridge {
160 int (*lm_set) (struct vme_lm_resource *, unsigned long long, u32, u32); 160 int (*lm_set) (struct vme_lm_resource *, unsigned long long, u32, u32);
161 int (*lm_get) (struct vme_lm_resource *, unsigned long long *, u32 *, 161 int (*lm_get) (struct vme_lm_resource *, unsigned long long *, u32 *,
162 u32 *); 162 u32 *);
163 int (*lm_attach) (struct vme_lm_resource *, int, void (*callback)(int)); 163 int (*lm_attach)(struct vme_lm_resource *, int,
164 void (*callback)(void *), void *);
164 int (*lm_detach) (struct vme_lm_resource *, int); 165 int (*lm_detach) (struct vme_lm_resource *, int);
165 166
166 /* CR/CSR space functions */ 167 /* CR/CSR space functions */