Commit 4a561c4b authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[media] cobalt: fix sparse warnings

drivers/media/pci/cobalt/cobalt-flash.c:39:36: warning: incorrect type in initializer (different address spaces)
drivers/media/pci/cobalt/cobalt-flash.c:54:36: warning: incorrect type in initializer (different address spaces)
drivers/media/pci/cobalt/cobalt-flash.c:63:36: warning: incorrect type in initializer (different address spaces)
drivers/media/pci/cobalt/cobalt-flash.c:82:36: warning: incorrect type in initializer (different address spaces)
drivers/media/pci/cobalt/cobalt-flash.c:107:19: warning: incorrect type in assignment (different address spaces)
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 1ba90492
...@@ -26,12 +26,12 @@ ...@@ -26,12 +26,12 @@
static u16 cpld_read(struct cobalt *cobalt, u32 offset) static u16 cpld_read(struct cobalt *cobalt, u32 offset)
{ {
return cobalt_bus_read32(cobalt, ADRS(offset)); return cobalt_bus_read32(cobalt->bar1, ADRS(offset));
} }
static void cpld_write(struct cobalt *cobalt, u32 offset, u16 val) static void cpld_write(struct cobalt *cobalt, u32 offset, u16 val)
{ {
return cobalt_bus_write32(cobalt, ADRS(offset), val); return cobalt_bus_write32(cobalt->bar1, ADRS(offset), val);
} }
static void cpld_info_ver3(struct cobalt *cobalt) static void cpld_info_ver3(struct cobalt *cobalt)
......
...@@ -296,11 +296,11 @@ static void cobalt_pci_iounmap(struct cobalt *cobalt, struct pci_dev *pci_dev) ...@@ -296,11 +296,11 @@ static void cobalt_pci_iounmap(struct cobalt *cobalt, struct pci_dev *pci_dev)
{ {
if (cobalt->bar0) { if (cobalt->bar0) {
pci_iounmap(pci_dev, cobalt->bar0); pci_iounmap(pci_dev, cobalt->bar0);
cobalt->bar0 = 0; cobalt->bar0 = NULL;
} }
if (cobalt->bar1) { if (cobalt->bar1) {
pci_iounmap(pci_dev, cobalt->bar1); pci_iounmap(pci_dev, cobalt->bar1);
cobalt->bar1 = 0; cobalt->bar1 = NULL;
} }
} }
......
...@@ -342,17 +342,17 @@ static inline u32 cobalt_g_sysstat(struct cobalt *cobalt) ...@@ -342,17 +342,17 @@ static inline u32 cobalt_g_sysstat(struct cobalt *cobalt)
return cobalt_read_bar1(cobalt, COBALT_SYS_STAT_BASE); return cobalt_read_bar1(cobalt, COBALT_SYS_STAT_BASE);
} }
#define ADRS_REG (cobalt->bar1 + COBALT_BUS_BAR1_BASE + 0) #define ADRS_REG (bar1 + COBALT_BUS_BAR1_BASE + 0)
#define LOWER_DATA (cobalt->bar1 + COBALT_BUS_BAR1_BASE + 4) #define LOWER_DATA (bar1 + COBALT_BUS_BAR1_BASE + 4)
#define UPPER_DATA (cobalt->bar1 + COBALT_BUS_BAR1_BASE + 6) #define UPPER_DATA (bar1 + COBALT_BUS_BAR1_BASE + 6)
static inline u32 cobalt_bus_read32(struct cobalt *cobalt, u32 bus_adrs) static inline u32 cobalt_bus_read32(void __iomem *bar1, u32 bus_adrs)
{ {
iowrite32(bus_adrs, ADRS_REG); iowrite32(bus_adrs, ADRS_REG);
return ioread32(LOWER_DATA); return ioread32(LOWER_DATA);
} }
static inline void cobalt_bus_write16(struct cobalt *cobalt, static inline void cobalt_bus_write16(void __iomem *bar1,
u32 bus_adrs, u16 data) u32 bus_adrs, u16 data)
{ {
iowrite32(bus_adrs, ADRS_REG); iowrite32(bus_adrs, ADRS_REG);
...@@ -362,7 +362,7 @@ static inline void cobalt_bus_write16(struct cobalt *cobalt, ...@@ -362,7 +362,7 @@ static inline void cobalt_bus_write16(struct cobalt *cobalt,
iowrite16(data, LOWER_DATA); iowrite16(data, LOWER_DATA);
} }
static inline void cobalt_bus_write32(struct cobalt *cobalt, static inline void cobalt_bus_write32(void __iomem *bar1,
u32 bus_adrs, u16 data) u32 bus_adrs, u16 data)
{ {
iowrite32(bus_adrs, ADRS_REG); iowrite32(bus_adrs, ADRS_REG);
......
...@@ -36,10 +36,9 @@ static struct map_info cobalt_flash_map = { ...@@ -36,10 +36,9 @@ static struct map_info cobalt_flash_map = {
static map_word flash_read16(struct map_info *map, unsigned long offset) static map_word flash_read16(struct map_info *map, unsigned long offset)
{ {
struct cobalt *cobalt = map->virt;
map_word r; map_word r;
r.x[0] = cobalt_bus_read32(cobalt, ADRS(offset)); r.x[0] = cobalt_bus_read32(map->virt, ADRS(offset));
if (offset & 0x2) if (offset & 0x2)
r.x[0] >>= 16; r.x[0] >>= 16;
else else
...@@ -51,22 +50,20 @@ static map_word flash_read16(struct map_info *map, unsigned long offset) ...@@ -51,22 +50,20 @@ static map_word flash_read16(struct map_info *map, unsigned long offset)
static void flash_write16(struct map_info *map, const map_word datum, static void flash_write16(struct map_info *map, const map_word datum,
unsigned long offset) unsigned long offset)
{ {
struct cobalt *cobalt = map->virt;
u16 data = (u16)datum.x[0]; u16 data = (u16)datum.x[0];
cobalt_bus_write16(cobalt, ADRS(offset), data); cobalt_bus_write16(map->virt, ADRS(offset), data);
} }
static void flash_copy_from(struct map_info *map, void *to, static void flash_copy_from(struct map_info *map, void *to,
unsigned long from, ssize_t len) unsigned long from, ssize_t len)
{ {
struct cobalt *cobalt = map->virt;
u32 src = from; u32 src = from;
u8 *dest = to; u8 *dest = to;
u32 data; u32 data;
while (len) { while (len) {
data = cobalt_bus_read32(cobalt, ADRS(src)); data = cobalt_bus_read32(map->virt, ADRS(src));
do { do {
*dest = data >> (8 * (src & 3)); *dest = data >> (8 * (src & 3));
src++; src++;
...@@ -79,11 +76,10 @@ static void flash_copy_from(struct map_info *map, void *to, ...@@ -79,11 +76,10 @@ static void flash_copy_from(struct map_info *map, void *to,
static void flash_copy_to(struct map_info *map, unsigned long to, static void flash_copy_to(struct map_info *map, unsigned long to,
const void *from, ssize_t len) const void *from, ssize_t len)
{ {
struct cobalt *cobalt = map->virt;
const u8 *src = from; const u8 *src = from;
u32 dest = to; u32 dest = to;
cobalt_info("%s: offset 0x%x: length %zu\n", __func__, dest, len); pr_info("%s: offset 0x%x: length %zu\n", __func__, dest, len);
while (len) { while (len) {
u16 data = 0xffff; u16 data = 0xffff;
...@@ -94,7 +90,7 @@ static void flash_copy_to(struct map_info *map, unsigned long to, ...@@ -94,7 +90,7 @@ static void flash_copy_to(struct map_info *map, unsigned long to,
len--; len--;
} while (len && (dest % 2)); } while (len && (dest % 2));
cobalt_bus_write16(cobalt, ADRS(dest - 2), data); cobalt_bus_write16(map->virt, ADRS(dest - 2), data);
} }
} }
...@@ -104,7 +100,7 @@ int cobalt_flash_probe(struct cobalt *cobalt) ...@@ -104,7 +100,7 @@ int cobalt_flash_probe(struct cobalt *cobalt)
struct mtd_info *mtd; struct mtd_info *mtd;
BUG_ON(!map_bankwidth_supported(map->bankwidth)); BUG_ON(!map_bankwidth_supported(map->bankwidth));
map->virt = cobalt; map->virt = cobalt->bar1;
map->read = flash_read16; map->read = flash_read16;
map->write = flash_write16; map->write = flash_write16;
map->copy_from = flash_copy_from; map->copy_from = flash_copy_from;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment