The gcc complains about the cast pointer to int on 64-bit as follows.
Use unsigned long instead and wrap it up in new macro.
CC [M] drivers/staging/vme/bridges/vme_ca91cx42.o
drivers/staging/vme/bridges/vme_ca91cx42.c: In function ‘ca91cx42_master_read’:
drivers/staging/vme/bridges/vme_ca91cx42.c:870: warning: cast from pointer to integer of different size
drivers/staging/vme/bridges/vme_ca91cx42.c:876: warning: cast from pointer to integer of different size
drivers/staging/vme/bridges/vme_ca91cx42.c: In function ‘ca91cx42_master_write’:
drivers/staging/vme/bridges/vme_ca91cx42.c:924: warning: cast from pointer to integer of different size
drivers/staging/vme/bridges/vme_ca91cx42.c:930: warning: cast from pointer to integer of different size
drivers/staging/vme/bridges/vme_ca91cx42.c: In function ‘ca91cx42_master_rmw’:
drivers/staging/vme/bridges/vme_ca91cx42.c:983: warning: cast from pointer to integer of different size
Signed-off-by: Namhyung Kim <[email protected]>
---
I'm not sure about the name. Suggestions?
drivers/staging/vme/bridges/vme_ca91cx42.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/vme/bridges/vme_ca91cx42.c b/drivers/staging/vme/bridges/vme_ca91cx42.c
index d1df7d12f504..cb72a5d1eeca 100644
--- a/drivers/staging/vme/bridges/vme_ca91cx42.c
+++ b/drivers/staging/vme/bridges/vme_ca91cx42.c
@@ -845,6 +845,8 @@ int ca91cx42_master_get(struct vme_master_resource *image, int *enabled,
return retval;
}
+#define check_aligned(addr, align) ((unsigned long)addr & align)
+
ssize_t ca91cx42_master_read(struct vme_master_resource *image, void *buf,
size_t count, loff_t offset)
{
@@ -867,13 +869,13 @@ ssize_t ca91cx42_master_read(struct vme_master_resource *image, void *buf,
* maximal configured data cycle is used and splits it
* automatically for non-aligned addresses.
*/
- if ((int)addr & 0x1) {
+ if (check_aligned(addr, 0x1)) {
*(u8 *)buf = ioread8(addr);
done += 1;
if (done == count)
goto out;
}
- if ((int)addr & 0x2) {
+ if (check_aligned(addr, 0x2)) {
if ((count - done) < 2) {
*(u8 *)(buf + done) = ioread8(addr + done);
done += 1;
@@ -921,13 +923,13 @@ ssize_t ca91cx42_master_write(struct vme_master_resource *image, void *buf,
/* Here we apply for the same strategy we do in master_read
* function in order to assure D16 cycle when required.
*/
- if ((int)addr & 0x1) {
+ if (check_aligned(addr, 0x1)) {
iowrite8(*(u8 *)buf, addr);
done += 1;
if (done == count)
goto out;
}
- if ((int)addr & 0x2) {
+ if (check_aligned(addr, 0x2)) {
if ((count - done) < 2) {
iowrite8(*(u8 *)(buf + done), addr + done);
done += 1;
@@ -980,7 +982,7 @@ unsigned int ca91cx42_master_rmw(struct vme_master_resource *image,
/* Lock image */
spin_lock(&(image->lock));
- pci_addr = (u32)image->kern_base + offset;
+ pci_addr = (u32)(unsigned long)image->kern_base + offset;
/* Address must be 4-byte aligned */
if (pci_addr & 0x3) {
--
1.7.3.3.400.g93cef
vme_master_resource->kern_base is mapped by ioremap_nocache()
thus should be marked as __iomem.
Signed-off-by: Namhyung Kim <[email protected]>
---
drivers/staging/vme/bridges/vme_ca91cx42.c | 4 ++--
drivers/staging/vme/vme_bridge.h | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/vme/bridges/vme_ca91cx42.c b/drivers/staging/vme/bridges/vme_ca91cx42.c
index cb72a5d1eeca..a9ce1810bd94 100644
--- a/drivers/staging/vme/bridges/vme_ca91cx42.c
+++ b/drivers/staging/vme/bridges/vme_ca91cx42.c
@@ -851,7 +851,7 @@ ssize_t ca91cx42_master_read(struct vme_master_resource *image, void *buf,
size_t count, loff_t offset)
{
ssize_t retval;
- void *addr = image->kern_base + offset;
+ void __iomem *addr = image->kern_base + offset;
unsigned int done = 0;
unsigned int count32;
@@ -911,7 +911,7 @@ ssize_t ca91cx42_master_write(struct vme_master_resource *image, void *buf,
size_t count, loff_t offset)
{
ssize_t retval;
- void *addr = image->kern_base + offset;
+ void __iomem *addr = image->kern_base + offset;
unsigned int done = 0;
unsigned int count32;
diff --git a/drivers/staging/vme/vme_bridge.h b/drivers/staging/vme/vme_bridge.h
index b653ec02e1fc..4c6ec31b01db 100644
--- a/drivers/staging/vme/vme_bridge.h
+++ b/drivers/staging/vme/vme_bridge.h
@@ -20,7 +20,7 @@ struct vme_master_resource {
vme_cycle_t cycle_attr;
vme_width_t width_attr;
struct resource bus_resource;
- void *kern_base;
+ void __iomem *kern_base;
};
struct vme_slave_resource {
--
1.7.3.3.400.g93cef
The iounmap() call and a assignment are could not be executed
because they have no label. Remove them and merge short lines.
Signed-off-by: Namhyung Kim <[email protected]>
---
drivers/staging/vme/bridges/vme_ca91cx42.c | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/vme/bridges/vme_ca91cx42.c b/drivers/staging/vme/bridges/vme_ca91cx42.c
index a9ce1810bd94..1052a6d101cd 100644
--- a/drivers/staging/vme/bridges/vme_ca91cx42.c
+++ b/drivers/staging/vme/bridges/vme_ca91cx42.c
@@ -551,8 +551,7 @@ static int ca91cx42_alloc_resource(struct vme_master_resource *image,
goto err_resource;
}
- image->kern_base = ioremap_nocache(
- image->bus_resource.start, size);
+ image->kern_base = ioremap_nocache(image->bus_resource.start, size);
if (image->kern_base == NULL) {
dev_err(ca91cx42_bridge->parent, "Failed to remap resource\n");
retval = -ENOMEM;
@@ -561,8 +560,6 @@ static int ca91cx42_alloc_resource(struct vme_master_resource *image,
return 0;
- iounmap(image->kern_base);
- image->kern_base = NULL;
err_remap:
release_resource(&(image->bus_resource));
err_resource:
--
1.7.3.3.400.g93cef
tsi148_driver->base is mapped by ioremap_nocache() thus
should be marked as __iomem.
Signed-off-by: Namhyung Kim <[email protected]>
---
drivers/staging/vme/bridges/vme_tsi148.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/staging/vme/bridges/vme_tsi148.h b/drivers/staging/vme/bridges/vme_tsi148.h
index bda64ef85754..9f97fa8084e8 100644
--- a/drivers/staging/vme/bridges/vme_tsi148.h
+++ b/drivers/staging/vme/bridges/vme_tsi148.h
@@ -35,7 +35,7 @@
/* Structure used to hold driver specific information */
struct tsi148_driver {
- void *base; /* Base Address of device registers */
+ void __iomem *base; /* Base Address of device registers */
wait_queue_head_t dma_queue[2];
wait_queue_head_t iack_queue;
void (*lm_callback[4])(int); /* Called in interrupt handler */
--
1.7.3.3.400.g93cef
Declare internal functions static.
Signed-off-by: Namhyung Kim <[email protected]>
---
drivers/staging/vme/bridges/vme_tsi148.c | 49 +++++++++++++++--------------
1 files changed, 25 insertions(+), 24 deletions(-)
diff --git a/drivers/staging/vme/bridges/vme_tsi148.c b/drivers/staging/vme/bridges/vme_tsi148.c
index a4c7f206cec6..1cb15e5c9923 100644
--- a/drivers/staging/vme/bridges/vme_tsi148.c
+++ b/drivers/staging/vme/bridges/vme_tsi148.c
@@ -391,7 +391,7 @@ static void tsi148_irq_exit(struct tsi148_driver *bridge, struct pci_dev *pdev)
/*
* Check to see if an IACk has been received, return true (1) or false (0).
*/
-int tsi148_iack_received(struct tsi148_driver *bridge)
+static int tsi148_iack_received(struct tsi148_driver *bridge)
{
u32 tmp;
@@ -406,7 +406,7 @@ int tsi148_iack_received(struct tsi148_driver *bridge)
/*
* Configure VME interrupt
*/
-void tsi148_irq_set(struct vme_bridge *tsi148_bridge, int level,
+static void tsi148_irq_set(struct vme_bridge *tsi148_bridge, int level,
int state, int sync)
{
struct pci_dev *pdev;
@@ -446,7 +446,8 @@ void tsi148_irq_set(struct vme_bridge *tsi148_bridge, int level,
* Generate a VME bus interrupt at the requested level & vector. Wait for
* interrupt to be acked.
*/
-int tsi148_irq_generate(struct vme_bridge *tsi148_bridge, int level, int statid)
+static int tsi148_irq_generate(struct vme_bridge *tsi148_bridge, int level,
+ int statid)
{
u32 tmp;
struct tsi148_driver *bridge;
@@ -546,7 +547,7 @@ static void tsi148_clear_errors(struct vme_bridge *tsi148_bridge,
/*
* Initialize a slave window with the requested attributes.
*/
-int tsi148_slave_set(struct vme_slave_resource *image, int enabled,
+static int tsi148_slave_set(struct vme_slave_resource *image, int enabled,
unsigned long long vme_base, unsigned long long size,
dma_addr_t pci_base, vme_address_t aspace, vme_cycle_t cycle)
{
@@ -696,7 +697,7 @@ int tsi148_slave_set(struct vme_slave_resource *image, int enabled,
/*
* Get slave window configuration.
*/
-int tsi148_slave_get(struct vme_slave_resource *image, int *enabled,
+static int tsi148_slave_get(struct vme_slave_resource *image, int *enabled,
unsigned long long *vme_base, unsigned long long *size,
dma_addr_t *pci_base, vme_address_t *aspace, vme_cycle_t *cycle)
{
@@ -889,7 +890,7 @@ static void tsi148_free_resource(struct vme_master_resource *image)
/*
* Set the attributes of an outbound window.
*/
-int tsi148_master_set(struct vme_master_resource *image, int enabled,
+static int tsi148_master_set(struct vme_master_resource *image, int enabled,
unsigned long long vme_base, unsigned long long size,
vme_address_t aspace, vme_cycle_t cycle, vme_width_t dwidth)
{
@@ -1125,7 +1126,7 @@ err_window:
*
* XXX Not parsing prefetch information.
*/
-int __tsi148_master_get(struct vme_master_resource *image, int *enabled,
+static int __tsi148_master_get(struct vme_master_resource *image, int *enabled,
unsigned long long *vme_base, unsigned long long *size,
vme_address_t *aspace, vme_cycle_t *cycle, vme_width_t *dwidth)
{
@@ -1235,7 +1236,7 @@ int __tsi148_master_get(struct vme_master_resource *image, int *enabled,
}
-int tsi148_master_get(struct vme_master_resource *image, int *enabled,
+static int tsi148_master_get(struct vme_master_resource *image, int *enabled,
unsigned long long *vme_base, unsigned long long *size,
vme_address_t *aspace, vme_cycle_t *cycle, vme_width_t *dwidth)
{
@@ -1251,8 +1252,8 @@ int tsi148_master_get(struct vme_master_resource *image, int *enabled,
return retval;
}
-ssize_t tsi148_master_read(struct vme_master_resource *image, void *buf,
- size_t count, loff_t offset)
+static ssize_t tsi148_master_read(struct vme_master_resource *image,
+ void *buf, size_t count, loff_t offset)
{
int retval, enabled;
unsigned long long vme_base, size;
@@ -1293,8 +1294,8 @@ skip_chk:
}
-ssize_t tsi148_master_write(struct vme_master_resource *image, void *buf,
- size_t count, loff_t offset)
+static ssize_t tsi148_master_write(struct vme_master_resource *image,
+ void *buf, size_t count, loff_t offset)
{
int retval = 0, enabled;
unsigned long long vme_base, size;
@@ -1360,7 +1361,7 @@ skip_chk:
*
* Requires a previously configured master window, returns final value.
*/
-unsigned int tsi148_master_rmw(struct vme_master_resource *image,
+static unsigned int tsi148_master_rmw(struct vme_master_resource *image,
unsigned int mask, unsigned int compare, unsigned int swap,
loff_t offset)
{
@@ -1607,8 +1608,8 @@ static int tsi148_dma_set_vme_dest_attributes(struct device *dev, u32 *attr,
/*
* Add a link list descriptor to the list
*/
-int tsi148_dma_list_add(struct vme_dma_list *list, struct vme_dma_attr *src,
- struct vme_dma_attr *dest, size_t count)
+static int tsi148_dma_list_add(struct vme_dma_list *list,
+ struct vme_dma_attr *src, struct vme_dma_attr *dest, size_t count)
{
struct tsi148_dma_entry *entry, *prev;
u32 address_high, address_low;
@@ -1780,7 +1781,7 @@ static int tsi148_dma_busy(struct vme_bridge *tsi148_bridge, int channel)
*
* XXX Need to provide control register configuration.
*/
-int tsi148_dma_list_exec(struct vme_dma_list *list)
+static int tsi148_dma_list_exec(struct vme_dma_list *list)
{
struct vme_dma_resource *ctrlr;
int channel, retval = 0;
@@ -1860,7 +1861,7 @@ int tsi148_dma_list_exec(struct vme_dma_list *list)
*
* We have a separate function, don't assume that the chain can't be reused.
*/
-int tsi148_dma_list_empty(struct vme_dma_list *list)
+static int tsi148_dma_list_empty(struct vme_dma_list *list)
{
struct list_head *pos, *temp;
struct tsi148_dma_entry *entry;
@@ -1882,8 +1883,8 @@ int tsi148_dma_list_empty(struct vme_dma_list *list)
* This does not enable the LM monitor - that should be done when the first
* callback is attached and disabled when the last callback is removed.
*/
-int tsi148_lm_set(struct vme_lm_resource *lm, unsigned long long lm_base,
- vme_address_t aspace, vme_cycle_t cycle)
+static int tsi148_lm_set(struct vme_lm_resource *lm,
+ unsigned long long lm_base, vme_address_t aspace, vme_cycle_t cycle)
{
u32 lm_base_high, lm_base_low, lm_ctl = 0;
int i;
@@ -1949,8 +1950,8 @@ int tsi148_lm_set(struct vme_lm_resource *lm, unsigned long long lm_base,
/* Get configuration of the callback monitor and return whether it is enabled
* or disabled.
*/
-int tsi148_lm_get(struct vme_lm_resource *lm, unsigned long long *lm_base,
- vme_address_t *aspace, vme_cycle_t *cycle)
+static int tsi148_lm_get(struct vme_lm_resource *lm,
+ unsigned long long *lm_base, vme_address_t *aspace, vme_cycle_t *cycle)
{
u32 lm_base_high, lm_base_low, lm_ctl, enabled = 0;
struct tsi148_driver *bridge;
@@ -2000,7 +2001,7 @@ int tsi148_lm_get(struct vme_lm_resource *lm, unsigned long long *lm_base,
*
* Callback will be passed the monitor triggered.
*/
-int tsi148_lm_attach(struct vme_lm_resource *lm, int monitor,
+static int tsi148_lm_attach(struct vme_lm_resource *lm, int monitor,
void (*callback)(int))
{
u32 lm_ctl, tmp;
@@ -2055,7 +2056,7 @@ int tsi148_lm_attach(struct vme_lm_resource *lm, int monitor,
/*
* Detach a callback function forn a specific location monitor.
*/
-int tsi148_lm_detach(struct vme_lm_resource *lm, int monitor)
+static int tsi148_lm_detach(struct vme_lm_resource *lm, int monitor)
{
u32 lm_en, tmp;
struct tsi148_driver *bridge;
@@ -2095,7 +2096,7 @@ int tsi148_lm_detach(struct vme_lm_resource *lm, int monitor)
/*
* Determine Geographical Addressing
*/
-int tsi148_slot_get(struct vme_bridge *tsi148_bridge)
+static int tsi148_slot_get(struct vme_bridge *tsi148_bridge)
{
u32 slot = 0;
struct tsi148_driver *bridge;
--
1.7.3.3.400.g93cef
The iounmap() call and a assignment are could not be executed
because they have no label. Remove them and merge short lines.
Signed-off-by: Namhyung Kim <[email protected]>
---
drivers/staging/vme/bridges/vme_tsi148.c | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/vme/bridges/vme_tsi148.c b/drivers/staging/vme/bridges/vme_tsi148.c
index 0ec9fa4768c2..a4c7f206cec6 100644
--- a/drivers/staging/vme/bridges/vme_tsi148.c
+++ b/drivers/staging/vme/bridges/vme_tsi148.c
@@ -856,8 +856,7 @@ static int tsi148_alloc_resource(struct vme_master_resource *image,
goto err_resource;
}
- image->kern_base = ioremap_nocache(
- image->bus_resource.start, size);
+ image->kern_base = ioremap_nocache(image->bus_resource.start, size);
if (image->kern_base == NULL) {
dev_err(tsi148_bridge->parent, "Failed to remap resource\n");
retval = -ENOMEM;
@@ -866,8 +865,6 @@ static int tsi148_alloc_resource(struct vme_master_resource *image,
return 0;
- iounmap(image->kern_base);
- image->kern_base = NULL;
err_remap:
release_resource(&(image->bus_resource));
err_resource:
--
1.7.3.3.400.g93cef
ca91cx42_driver->base is mapped by ioremap_nocache() thus
should be marked as __iomem.
Signed-off-by: Namhyung Kim <[email protected]>
---
drivers/staging/vme/bridges/vme_ca91cx42.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/staging/vme/bridges/vme_ca91cx42.h b/drivers/staging/vme/bridges/vme_ca91cx42.h
index e72c65b193ec..02a7c794db05 100644
--- a/drivers/staging/vme/bridges/vme_ca91cx42.h
+++ b/drivers/staging/vme/bridges/vme_ca91cx42.h
@@ -39,7 +39,7 @@
/* Structure used to hold driver specific information */
struct ca91cx42_driver {
- void *base; /* Base Address of device registers */
+ void __iomem *base; /* Base Address of device registers */
wait_queue_head_t dma_queue;
wait_queue_head_t iack_queue;
wait_queue_head_t mbox_queue;
--
1.7.3.3.400.g93cef
Declare internal functions static.
Signed-off-by: Namhyung Kim <[email protected]>
---
drivers/staging/vme/bridges/vme_ca91cx42.c | 54 ++++++++++++++--------------
1 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/drivers/staging/vme/bridges/vme_ca91cx42.c b/drivers/staging/vme/bridges/vme_ca91cx42.c
index 1052a6d101cd..cfac1f128dea 100644
--- a/drivers/staging/vme/bridges/vme_ca91cx42.c
+++ b/drivers/staging/vme/bridges/vme_ca91cx42.c
@@ -260,8 +260,8 @@ static void ca91cx42_irq_exit(struct ca91cx42_driver *bridge,
/*
* Set up an VME interrupt
*/
-void ca91cx42_irq_set(struct vme_bridge *ca91cx42_bridge, int level, int state,
- int sync)
+static void ca91cx42_irq_set(struct vme_bridge *ca91cx42_bridge, int level,
+ int state, int sync)
{
struct pci_dev *pdev;
@@ -288,8 +288,8 @@ void ca91cx42_irq_set(struct vme_bridge *ca91cx42_bridge, int level, int state,
}
}
-int ca91cx42_irq_generate(struct vme_bridge *ca91cx42_bridge, int level,
- int statid)
+static int ca91cx42_irq_generate(struct vme_bridge *ca91cx42_bridge,
+ int level, int statid)
{
u32 tmp;
struct ca91cx42_driver *bridge;
@@ -324,7 +324,7 @@ int ca91cx42_irq_generate(struct vme_bridge *ca91cx42_bridge, int level,
return 0;
}
-int ca91cx42_slave_set(struct vme_slave_resource *image, int enabled,
+static int ca91cx42_slave_set(struct vme_slave_resource *image, int enabled,
unsigned long long vme_base, unsigned long long size,
dma_addr_t pci_base, vme_address_t aspace, vme_cycle_t cycle)
{
@@ -430,7 +430,7 @@ int ca91cx42_slave_set(struct vme_slave_resource *image, int enabled,
return 0;
}
-int ca91cx42_slave_get(struct vme_slave_resource *image, int *enabled,
+static int ca91cx42_slave_get(struct vme_slave_resource *image, int *enabled,
unsigned long long *vme_base, unsigned long long *size,
dma_addr_t *pci_base, vme_address_t *aspace, vme_cycle_t *cycle)
{
@@ -582,7 +582,7 @@ static void ca91cx42_free_resource(struct vme_master_resource *image)
}
-int ca91cx42_master_set(struct vme_master_resource *image, int enabled,
+static int ca91cx42_master_set(struct vme_master_resource *image, int enabled,
unsigned long long vme_base, unsigned long long size,
vme_address_t aspace, vme_cycle_t cycle, vme_width_t dwidth)
{
@@ -739,8 +739,8 @@ err_window:
return retval;
}
-int __ca91cx42_master_get(struct vme_master_resource *image, int *enabled,
- unsigned long long *vme_base, unsigned long long *size,
+static int __ca91cx42_master_get(struct vme_master_resource *image,
+ int *enabled, unsigned long long *vme_base, unsigned long long *size,
vme_address_t *aspace, vme_cycle_t *cycle, vme_width_t *dwidth)
{
unsigned int i, ctl;
@@ -826,7 +826,7 @@ int __ca91cx42_master_get(struct vme_master_resource *image, int *enabled,
return 0;
}
-int ca91cx42_master_get(struct vme_master_resource *image, int *enabled,
+static int ca91cx42_master_get(struct vme_master_resource *image, int *enabled,
unsigned long long *vme_base, unsigned long long *size,
vme_address_t *aspace, vme_cycle_t *cycle, vme_width_t *dwidth)
{
@@ -844,8 +844,8 @@ int ca91cx42_master_get(struct vme_master_resource *image, int *enabled,
#define check_aligned(addr, align) ((unsigned long)addr & align)
-ssize_t ca91cx42_master_read(struct vme_master_resource *image, void *buf,
- size_t count, loff_t offset)
+static ssize_t ca91cx42_master_read(struct vme_master_resource *image,
+ void *buf, size_t count, loff_t offset)
{
ssize_t retval;
void __iomem *addr = image->kern_base + offset;
@@ -904,8 +904,8 @@ out:
return retval;
}
-ssize_t ca91cx42_master_write(struct vme_master_resource *image, void *buf,
- size_t count, loff_t offset)
+static ssize_t ca91cx42_master_write(struct vme_master_resource *image,
+ void *buf, size_t count, loff_t offset)
{
ssize_t retval;
void __iomem *addr = image->kern_base + offset;
@@ -958,7 +958,7 @@ out:
return retval;
}
-unsigned int ca91cx42_master_rmw(struct vme_master_resource *image,
+static unsigned int ca91cx42_master_rmw(struct vme_master_resource *image,
unsigned int mask, unsigned int compare, unsigned int swap,
loff_t offset)
{
@@ -1014,8 +1014,8 @@ out:
return result;
}
-int ca91cx42_dma_list_add(struct vme_dma_list *list, struct vme_dma_attr *src,
- struct vme_dma_attr *dest, size_t count)
+static int ca91cx42_dma_list_add(struct vme_dma_list *list,
+ struct vme_dma_attr *src, struct vme_dma_attr *dest, size_t count)
{
struct ca91cx42_dma_entry *entry, *prev;
struct vme_dma_pci *pci_attr;
@@ -1175,7 +1175,7 @@ static int ca91cx42_dma_busy(struct vme_bridge *ca91cx42_bridge)
return 1;
}
-int ca91cx42_dma_list_exec(struct vme_dma_list *list)
+static int ca91cx42_dma_list_exec(struct vme_dma_list *list)
{
struct vme_dma_resource *ctrlr;
struct ca91cx42_dma_entry *entry;
@@ -1257,7 +1257,7 @@ int ca91cx42_dma_list_exec(struct vme_dma_list *list)
}
-int ca91cx42_dma_list_empty(struct vme_dma_list *list)
+static int ca91cx42_dma_list_empty(struct vme_dma_list *list)
{
struct list_head *pos, *temp;
struct ca91cx42_dma_entry *entry;
@@ -1279,8 +1279,8 @@ int ca91cx42_dma_list_empty(struct vme_dma_list *list)
* This does not enable the LM monitor - that should be done when the first
* callback is attached and disabled when the last callback is removed.
*/
-int ca91cx42_lm_set(struct vme_lm_resource *lm, unsigned long long lm_base,
- vme_address_t aspace, vme_cycle_t cycle)
+static int ca91cx42_lm_set(struct vme_lm_resource *lm,
+ unsigned long long lm_base, vme_address_t aspace, vme_cycle_t cycle)
{
u32 temp_base, lm_ctl = 0;
int i;
@@ -1347,8 +1347,8 @@ int ca91cx42_lm_set(struct vme_lm_resource *lm, unsigned long long lm_base,
/* Get configuration of the callback monitor and return whether it is enabled
* or disabled.
*/
-int ca91cx42_lm_get(struct vme_lm_resource *lm, unsigned long long *lm_base,
- vme_address_t *aspace, vme_cycle_t *cycle)
+static int ca91cx42_lm_get(struct vme_lm_resource *lm,
+ unsigned long long *lm_base, vme_address_t *aspace, vme_cycle_t *cycle)
{
u32 lm_ctl, enabled = 0;
struct ca91cx42_driver *bridge;
@@ -1390,7 +1390,7 @@ int ca91cx42_lm_get(struct vme_lm_resource *lm, unsigned long long *lm_base,
*
* Callback will be passed the monitor triggered.
*/
-int ca91cx42_lm_attach(struct vme_lm_resource *lm, int monitor,
+static int ca91cx42_lm_attach(struct vme_lm_resource *lm, int monitor,
void (*callback)(int))
{
u32 lm_ctl, tmp;
@@ -1439,7 +1439,7 @@ int ca91cx42_lm_attach(struct vme_lm_resource *lm, int monitor,
/*
* Detach a callback function forn a specific location monitor.
*/
-int ca91cx42_lm_detach(struct vme_lm_resource *lm, int monitor)
+static int ca91cx42_lm_detach(struct vme_lm_resource *lm, int monitor)
{
u32 tmp;
struct ca91cx42_driver *bridge;
@@ -1472,7 +1472,7 @@ int ca91cx42_lm_detach(struct vme_lm_resource *lm, int monitor)
return 0;
}
-int ca91cx42_slot_get(struct vme_bridge *ca91cx42_bridge)
+static int ca91cx42_slot_get(struct vme_bridge *ca91cx42_bridge)
{
u32 slot = 0;
struct ca91cx42_driver *bridge;
@@ -1832,7 +1832,7 @@ err_struct:
}
-void __devexit ca91cx42_remove(struct pci_dev *pdev)
+static void __devexit ca91cx42_remove(struct pci_dev *pdev)
{
struct list_head *pos = NULL;
struct vme_master_resource *master_image;
--
1.7.3.3.400.g93cef
On 12/13/2010 02:16 PM, Namhyung Kim wrote:
> The gcc complains about the cast pointer to int on 64-bit as follows.
> Use unsigned long instead and wrap it up in new macro.
>
> CC [M] drivers/staging/vme/bridges/vme_ca91cx42.o
> drivers/staging/vme/bridges/vme_ca91cx42.c: In function ‘ca91cx42_master_read’:
> drivers/staging/vme/bridges/vme_ca91cx42.c:870: warning: cast from pointer to integer of different size
> drivers/staging/vme/bridges/vme_ca91cx42.c:876: warning: cast from pointer to integer of different size
> drivers/staging/vme/bridges/vme_ca91cx42.c: In function ‘ca91cx42_master_write’:
> drivers/staging/vme/bridges/vme_ca91cx42.c:924: warning: cast from pointer to integer of different size
> drivers/staging/vme/bridges/vme_ca91cx42.c:930: warning: cast from pointer to integer of different size
> drivers/staging/vme/bridges/vme_ca91cx42.c: In function ‘ca91cx42_master_rmw’:
> drivers/staging/vme/bridges/vme_ca91cx42.c:983: warning: cast from pointer to integer of different size
>
> Signed-off-by: Namhyung Kim <[email protected]>
> ---
> I'm not sure about the name. Suggestions?
>
> drivers/staging/vme/bridges/vme_ca91cx42.c | 12 +++++++-----
> 1 files changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/staging/vme/bridges/vme_ca91cx42.c b/drivers/staging/vme/bridges/vme_ca91cx42.c
> index d1df7d12f504..cb72a5d1eeca 100644
> --- a/drivers/staging/vme/bridges/vme_ca91cx42.c
> +++ b/drivers/staging/vme/bridges/vme_ca91cx42.c
> @@ -845,6 +845,8 @@ int ca91cx42_master_get(struct vme_master_resource *image, int *enabled,
> return retval;
> }
>
> +#define check_aligned(addr, align) ((unsigned long)addr & align)
> +
> ssize_t ca91cx42_master_read(struct vme_master_resource *image, void *buf,
> size_t count, loff_t offset)
> {
> @@ -867,13 +869,13 @@ ssize_t ca91cx42_master_read(struct vme_master_resource *image, void *buf,
> * maximal configured data cycle is used and splits it
> * automatically for non-aligned addresses.
> */
> - if ((int)addr & 0x1) {
> + if (check_aligned(addr, 0x1)) {
> *(u8 *)buf = ioread8(addr);
> done += 1;
> if (done == count)
> goto out;
> }
> - if ((int)addr & 0x2) {
> + if (check_aligned(addr, 0x2)) {
It should be IS_ALIGNED(addr, 2) and IS_ALIGNED(addr, 4) respectively
anyway...
> if ((count - done) < 2) {
> *(u8 *)(buf + done) = ioread8(addr + done);
> done += 1;
> @@ -921,13 +923,13 @@ ssize_t ca91cx42_master_write(struct vme_master_resource *image, void *buf,
> /* Here we apply for the same strategy we do in master_read
> * function in order to assure D16 cycle when required.
> */
> - if ((int)addr & 0x1) {
> + if (check_aligned(addr, 0x1)) {
> iowrite8(*(u8 *)buf, addr);
> done += 1;
> if (done == count)
> goto out;
> }
> - if ((int)addr & 0x2) {
> + if (check_aligned(addr, 0x2)) {
> if ((count - done) < 2) {
> iowrite8(*(u8 *)(buf + done), addr + done);
> done += 1;
> @@ -980,7 +982,7 @@ unsigned int ca91cx42_master_rmw(struct vme_master_resource *image,
> /* Lock image */
> spin_lock(&(image->lock));
>
> - pci_addr = (u32)image->kern_base + offset;
> + pci_addr = (u32)(unsigned long)image->kern_base + offset;
No, do not hide bugs here. I see no reason why address returned from
ioremap couldn't be larger than 32 bits. Actually it is always on 64bit.
Actually what this code tries to do? Shouldn't it be physical address of
the PCI resource instead?
regards,
--
js
2010-12-13 (월), 14:50 +0100, Jiri Slaby:
> On 12/13/2010 02:16 PM, Namhyung Kim wrote:
> > @@ -867,13 +869,13 @@ ssize_t ca91cx42_master_read(struct vme_master_resource *image, void *buf,
> > * maximal configured data cycle is used and splits it
> > * automatically for non-aligned addresses.
> > */
> > - if ((int)addr & 0x1) {
> > + if (check_aligned(addr, 0x1)) {
> > *(u8 *)buf = ioread8(addr);
> > done += 1;
> > if (done == count)
> > goto out;
> > }
> > - if ((int)addr & 0x2) {
> > + if (check_aligned(addr, 0x2)) {
>
> It should be IS_ALIGNED(addr, 2) and IS_ALIGNED(addr, 4) respectively
> anyway...
>
That's what I was looking for, thanks. :)
> > @@ -980,7 +982,7 @@ unsigned int ca91cx42_master_rmw(struct vme_master_resource *image,
> > /* Lock image */
> > spin_lock(&(image->lock));
> >
> > - pci_addr = (u32)image->kern_base + offset;
> > + pci_addr = (u32)(unsigned long)image->kern_base + offset;
>
> No, do not hide bugs here. I see no reason why address returned from
> ioremap couldn't be larger than 32 bits. Actually it is always on 64bit.
>
> Actually what this code tries to do? Shouldn't it be physical address of
> the PCI resource instead?
>
> regards,
Sounds reasonable.
--
Regards,
Namhyung Kim
On Mon, Dec 13, 2010 at 10:16:30PM +0900, Namhyung Kim wrote:
> vme_master_resource->kern_base is mapped by ioremap_nocache()
> thus should be marked as __iomem.
>
> Signed-off-by: Namhyung Kim <[email protected]>
I need some acks from Martyn on this series (minus the broken 1/8 patch)
before I can apply them. Martyn?
thanks,
greg k-h
2010-12-13 (월), 10:36 -0800, Greg KH:
> On Mon, Dec 13, 2010 at 10:16:30PM +0900, Namhyung Kim wrote:
> > vme_master_resource->kern_base is mapped by ioremap_nocache()
> > thus should be marked as __iomem.
> >
> > Signed-off-by: Namhyung Kim <[email protected]>
>
> I need some acks from Martyn on this series (minus the broken 1/8 patch)
> before I can apply them. Martyn?
>
> thanks,
>
> greg k-h
Now I've checked -next tree and found patch 2 (partially), 3, 5, 6 and 8
are already in the tree. Sorry for my carelessness :( Will send v2.
--
Regards,
Namhyung Kim
On 14/12/10 04:52, Namhyung Kim wrote:
> 2010-12-13 (월), 10:36 -0800, Greg KH:
>> On Mon, Dec 13, 2010 at 10:16:30PM +0900, Namhyung Kim wrote:
>>> vme_master_resource->kern_base is mapped by ioremap_nocache()
>>> thus should be marked as __iomem.
>>>
>>> Signed-off-by: Namhyung Kim <[email protected]>
>>
>> I need some acks from Martyn on this series (minus the broken 1/8 patch)
>> before I can apply them. Martyn?
>>
>> thanks,
>>
>> greg k-h
>
> Now I've checked -next tree and found patch 2 (partially), 3, 5, 6 and 8
> are already in the tree. Sorry for my carelessness :( Will send v2.
>
>
I had a quick peek at these patches when they can in yesterday, I
thought there may have been quite a bit of overlap with the patches that
Emilio posted and needed to find time to look in more detail.
Martyn
--
Martyn Welch (Principal Software Engineer) | Registered in England and
GE Intelligent Platforms | Wales (3828642) at 100
T +44(0)127322748 | Barbirolli Square,
Manchester,
E [email protected] | M2 3AB VAT:GB 927559189