[PATCH 3/7] staging: slicoss: slicoss.c: fix different address space sparse warning
Signed-off-by: Peng Sun <sironhide0n...@gmail.com> --- drivers/staging/slicoss/slicoss.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index 8426392..2128963 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -1697,9 +1697,10 @@ static void slic_init_cleanup(struct adapter *adapter) if (adapter->shmem.shmem_data) { struct slic_shmemory *sm = >shmem; - struct slic_shmem_data *sm_data = sm->shmem_data; + struct slic_shmem_data __iomem *sm_data = sm->shmem_data; - pci_free_consistent(adapter->pcidev, sizeof(*sm_data), sm_data, + pci_free_consistent(adapter->pcidev, sizeof(*sm_data), + (void __force *)sm_data, sm->isr_phaddr); } -- 2.7.4
[PATCH 3/7] staging: slicoss: slicoss.c: fix different address space sparse warning
Signed-off-by: Peng Sun --- drivers/staging/slicoss/slicoss.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index 8426392..2128963 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -1697,9 +1697,10 @@ static void slic_init_cleanup(struct adapter *adapter) if (adapter->shmem.shmem_data) { struct slic_shmemory *sm = >shmem; - struct slic_shmem_data *sm_data = sm->shmem_data; + struct slic_shmem_data __iomem *sm_data = sm->shmem_data; - pci_free_consistent(adapter->pcidev, sizeof(*sm_data), sm_data, + pci_free_consistent(adapter->pcidev, sizeof(*sm_data), + (void __force *)sm_data, sm->isr_phaddr); } -- 2.7.4
[PATCH 4/7] staging: slicoss: slicoss.c: fix different address space sparse warning
add IOMEM_SET_FIELD32 to set u32 value of a member of a __iomem structure; Signed-off-by: Peng Sun <sironhide0n...@gmail.com> --- drivers/staging/slicoss/slic.h| 7 +++ drivers/staging/slicoss/slicoss.c | 8 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h index fec9ec5..b9595c4 100644 --- a/drivers/staging/slicoss/slic.h +++ b/drivers/staging/slicoss/slic.h @@ -553,6 +553,13 @@ static inline void slic_flush_write(struct adapter *adapter) ioread32(_base);\ }) +#define IOMEM_SET_FIELD32(value, base, member) \ +({ \ + char __iomem *_base = (char __iomem *)base; \ + _base += offsetof(typeof(*base), member); \ + iowrite32(value, _base);\ +}) + #ifdef CONFIG_64BIT #define IOMEM_GET_FIELD64(base, member) \ ({ \ diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index 2128963..c92b8c5 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -2087,15 +2087,15 @@ static irqreturn_t slic_interrupt(int irq, void *dev_id) struct net_device *dev = dev_id; struct adapter *adapter = netdev_priv(dev); struct slic_shmemory *sm = >shmem; - struct slic_shmem_data *sm_data = sm->shmem_data; + struct slic_shmem_data __iomem *sm_data = sm->shmem_data; u32 isr; - if (sm_data->isr) { + if (IOMEM_GET_FIELD32(sm_data, isr)) { slic_write32(adapter, SLIC_REG_ICR, ICR_INT_MASK); slic_flush_write(adapter); - isr = sm_data->isr; - sm_data->isr = 0; + isr = IOMEM_GET_FIELD32(sm_data, isr); + IOMEM_SET_FIELD32(0, sm_data, isr); adapter->num_isrs++; switch (adapter->card->state) { case CARD_UP: -- 2.7.4
[PATCH 2/7] staging: slicoss: slicoss.c: fix different address space sparse warning
add IOMEM_GET_FIELDADDR to get address of a member of a __iomem structure; add IOMEM_GET_FIELD64 to get u64 value of a member of a __iomem structure; Signed-off-by: Peng Sun <sironhide0n...@gmail.com> --- drivers/staging/slicoss/slic.h| 32 + drivers/staging/slicoss/slicoss.c | 49 +-- 2 files changed, 64 insertions(+), 17 deletions(-) diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h index 022e7f6..fec9ec5 100644 --- a/drivers/staging/slicoss/slic.h +++ b/drivers/staging/slicoss/slic.h @@ -539,6 +539,13 @@ static inline void slic_flush_write(struct adapter *adapter) ioread32(adapter->regs + SLIC_REG_HOSTID); } +#define IOMEM_GET_FIELDADDR(base, member) \ +({ \ + char __iomem *_base = (char __iomem *)base; \ + _base += offsetof(typeof(*base), member); \ + (void __iomem *)_base; \ +}) + #define IOMEM_GET_FIELD32(base, member) \ ({ \ char __iomem *_base = (char __iomem *)base; \ @@ -546,6 +553,31 @@ static inline void slic_flush_write(struct adapter *adapter) ioread32(_base);\ }) +#ifdef CONFIG_64BIT +#define IOMEM_GET_FIELD64(base, member) \ +({ \ + char __iomem *_base = (char __iomem *)base; \ + _base += offsetof(typeof(*base), member); \ + readq(_base); \ +}) +#else +#define IOMEM_GET_FIELD64(base, member) \ +({ \ + char __iomem *_base = (char __iomem *)base; \ + u64 val;\ + _base += offsetof(typeof(*base), member); \ + val = ((u64)ioread8(_base + 7)) << 56; \ + val += ((u64)ioread8(_base + 6)) << 48; \ + val += ((u64)ioread8(_base + 5)) << 40; \ + val += ((u64)ioread8(_base + 4)) << 32; \ + val += ((u64)ioread8(_base + 3)) << 24; \ + val += ((u64)ioread8(_base + 2)) << 16; \ + val += ((u64)ioread8(_base + 1)) << 8; \ + val += ioread8(_base); \ + le64_to_cpu(val); \ +}) +#endif + #define UPDATE_STATS(largestat, newstat, oldstat)\ {\ if ((newstat) < (oldstat)) \ diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index 929a0d5..8426392 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -1004,8 +1004,9 @@ static void slic_upr_request_complete(struct adapter *adapter, u32 isr) switch (upr->upr_request) { case SLIC_UPR_STATS: { struct slic_shmemory *sm = >shmem; - struct slic_shmem_data *sm_data = sm->shmem_data; - struct slic_stats *stats = _data->stats; + struct slic_shmem_data __iomem *sm_data = sm->shmem_data; + struct slic_stats __iomem *stats = + IOMEM_GET_FIELDADDR(sm_data, stats); struct slic_stats *old = >inicstats_prev; struct slicnet_stats *stst = >slic_stats; @@ -1015,48 +1016,62 @@ static void slic_upr_request_complete(struct adapter *adapter, u32 isr) break; } - UPDATE_STATS_GB(stst->tcp.xmit_tcp_segs, stats->xmit_tcp_segs, + UPDATE_STATS_GB(stst->tcp.xmit_tcp_segs, + IOMEM_GET_FIELD64(stats, xmit_tcp_segs), old->xmit_tcp_segs); - UPDATE_STATS_GB(stst->tcp.xmit_tcp_bytes, stats->xmit_tcp_bytes, + UPDATE_STATS_GB(stst->tcp.xmit_tcp_bytes, + IOMEM_GET_FIELD64(stats, xmit_tcp_bytes), old->xmit_tcp_bytes); - UPDATE_STATS_GB(stst->tcp.rcv_tcp_segs, stats->rcv_tcp_segs, + UPDATE_STATS_GB(stst->tcp.rcv_tcp_segs, +
[PATCH 5/7] staging: slicoss: slicoss.c: fix different address space sparse warning
Signed-off-by: Peng Sun <sironhide0n...@gmail.com> --- drivers/staging/slicoss/slicoss.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index c92b8c5..bf9b381 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -2230,7 +2230,7 @@ static int slic_if_init(struct adapter *adapter, unsigned long *flags) struct sliccard *card = adapter->card; struct net_device *dev = adapter->netdev; struct slic_shmemory *sm = >shmem; - struct slic_shmem_data *sm_data = sm->shmem_data; + struct slic_shmem_data __iomem *sm_data = sm->shmem_data; int rc; /* adapter should be down at this point */ @@ -2314,7 +2314,7 @@ static int slic_if_init(struct adapter *adapter, unsigned long *flags) /* *clear any pending events, then enable interrupts */ - sm_data->isr = 0; + IOMEM_SET_FIELD32(0, sm_data, isr); slic_write32(adapter, SLIC_REG_ISR, 0); slic_write32(adapter, SLIC_REG_ICR, ICR_INT_ON); -- 2.7.4
[PATCH 6/7] staging: slicoss: slicoss.c: fix different address space sparse warning
Signed-off-by: Peng Sun <sironhide0n...@gmail.com> --- drivers/staging/slicoss/slicoss.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index bf9b381..59c4fbc 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -2603,7 +2603,7 @@ static void slic_config_pci(struct pci_dev *pcidev) static int slic_card_init(struct sliccard *card, struct adapter *adapter) { struct slic_shmemory *sm = >shmem; - struct slic_shmem_data *sm_data = sm->shmem_data; + struct slic_shmem_data __iomem *sm_data = sm->shmem_data; struct slic_eeprom *peeprom; struct oslic_eeprom *pOeeprom; dma_addr_t phys_config; @@ -2666,9 +2666,9 @@ static int slic_card_init(struct sliccard *card, struct adapter *adapter) } for (;;) { - if (sm_data->isr) { - if (sm_data->isr & ISR_UPC) { - sm_data->isr = 0; + if (IOMEM_GET_FIELD32(sm_data, isr)) { + if (IOMEM_GET_FIELD32(sm_data, isr) & ISR_UPC) { + IOMEM_SET_FIELD32(0, sm_data, isr); slic_write64(adapter, SLIC_REG_ISP, 0, 0); slic_write32(adapter, SLIC_REG_ISR, 0); @@ -2678,7 +2678,7 @@ static int slic_card_init(struct sliccard *card, struct adapter *adapter) break; } - sm_data->isr = 0; + IOMEM_SET_FIELD32(0, sm_data, isr); slic_write32(adapter, SLIC_REG_ISR, 0); slic_flush_write(adapter); } else { -- 2.7.4
[PATCH 7/7] staging: slicoss: slicoss.c: fix different address space sparse warning
Signed-off-by: Peng Sun <sironhide0n...@gmail.com> --- drivers/staging/slicoss/slicoss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index 59c4fbc..abe7592 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -2883,7 +2883,7 @@ static int slic_init_adapter(struct net_device *netdev, if (!sm_data) return -ENOMEM; - sm->shmem_data = sm_data; + sm->shmem_data = (struct slic_shmem_data __force __iomem *)sm_data; sm->isr_phaddr = phaddr; sm->lnkstatus_phaddr = phaddr + offsetof(struct slic_shmem_data, lnkstatus); -- 2.7.4
[PATCH 4/7] staging: slicoss: slicoss.c: fix different address space sparse warning
add IOMEM_SET_FIELD32 to set u32 value of a member of a __iomem structure; Signed-off-by: Peng Sun --- drivers/staging/slicoss/slic.h| 7 +++ drivers/staging/slicoss/slicoss.c | 8 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h index fec9ec5..b9595c4 100644 --- a/drivers/staging/slicoss/slic.h +++ b/drivers/staging/slicoss/slic.h @@ -553,6 +553,13 @@ static inline void slic_flush_write(struct adapter *adapter) ioread32(_base);\ }) +#define IOMEM_SET_FIELD32(value, base, member) \ +({ \ + char __iomem *_base = (char __iomem *)base; \ + _base += offsetof(typeof(*base), member); \ + iowrite32(value, _base);\ +}) + #ifdef CONFIG_64BIT #define IOMEM_GET_FIELD64(base, member) \ ({ \ diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index 2128963..c92b8c5 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -2087,15 +2087,15 @@ static irqreturn_t slic_interrupt(int irq, void *dev_id) struct net_device *dev = dev_id; struct adapter *adapter = netdev_priv(dev); struct slic_shmemory *sm = >shmem; - struct slic_shmem_data *sm_data = sm->shmem_data; + struct slic_shmem_data __iomem *sm_data = sm->shmem_data; u32 isr; - if (sm_data->isr) { + if (IOMEM_GET_FIELD32(sm_data, isr)) { slic_write32(adapter, SLIC_REG_ICR, ICR_INT_MASK); slic_flush_write(adapter); - isr = sm_data->isr; - sm_data->isr = 0; + isr = IOMEM_GET_FIELD32(sm_data, isr); + IOMEM_SET_FIELD32(0, sm_data, isr); adapter->num_isrs++; switch (adapter->card->state) { case CARD_UP: -- 2.7.4
[PATCH 2/7] staging: slicoss: slicoss.c: fix different address space sparse warning
add IOMEM_GET_FIELDADDR to get address of a member of a __iomem structure; add IOMEM_GET_FIELD64 to get u64 value of a member of a __iomem structure; Signed-off-by: Peng Sun --- drivers/staging/slicoss/slic.h| 32 + drivers/staging/slicoss/slicoss.c | 49 +-- 2 files changed, 64 insertions(+), 17 deletions(-) diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h index 022e7f6..fec9ec5 100644 --- a/drivers/staging/slicoss/slic.h +++ b/drivers/staging/slicoss/slic.h @@ -539,6 +539,13 @@ static inline void slic_flush_write(struct adapter *adapter) ioread32(adapter->regs + SLIC_REG_HOSTID); } +#define IOMEM_GET_FIELDADDR(base, member) \ +({ \ + char __iomem *_base = (char __iomem *)base; \ + _base += offsetof(typeof(*base), member); \ + (void __iomem *)_base; \ +}) + #define IOMEM_GET_FIELD32(base, member) \ ({ \ char __iomem *_base = (char __iomem *)base; \ @@ -546,6 +553,31 @@ static inline void slic_flush_write(struct adapter *adapter) ioread32(_base);\ }) +#ifdef CONFIG_64BIT +#define IOMEM_GET_FIELD64(base, member) \ +({ \ + char __iomem *_base = (char __iomem *)base; \ + _base += offsetof(typeof(*base), member); \ + readq(_base); \ +}) +#else +#define IOMEM_GET_FIELD64(base, member) \ +({ \ + char __iomem *_base = (char __iomem *)base; \ + u64 val;\ + _base += offsetof(typeof(*base), member); \ + val = ((u64)ioread8(_base + 7)) << 56; \ + val += ((u64)ioread8(_base + 6)) << 48; \ + val += ((u64)ioread8(_base + 5)) << 40; \ + val += ((u64)ioread8(_base + 4)) << 32; \ + val += ((u64)ioread8(_base + 3)) << 24; \ + val += ((u64)ioread8(_base + 2)) << 16; \ + val += ((u64)ioread8(_base + 1)) << 8; \ + val += ioread8(_base); \ + le64_to_cpu(val); \ +}) +#endif + #define UPDATE_STATS(largestat, newstat, oldstat)\ {\ if ((newstat) < (oldstat)) \ diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index 929a0d5..8426392 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -1004,8 +1004,9 @@ static void slic_upr_request_complete(struct adapter *adapter, u32 isr) switch (upr->upr_request) { case SLIC_UPR_STATS: { struct slic_shmemory *sm = >shmem; - struct slic_shmem_data *sm_data = sm->shmem_data; - struct slic_stats *stats = _data->stats; + struct slic_shmem_data __iomem *sm_data = sm->shmem_data; + struct slic_stats __iomem *stats = + IOMEM_GET_FIELDADDR(sm_data, stats); struct slic_stats *old = >inicstats_prev; struct slicnet_stats *stst = >slic_stats; @@ -1015,48 +1016,62 @@ static void slic_upr_request_complete(struct adapter *adapter, u32 isr) break; } - UPDATE_STATS_GB(stst->tcp.xmit_tcp_segs, stats->xmit_tcp_segs, + UPDATE_STATS_GB(stst->tcp.xmit_tcp_segs, + IOMEM_GET_FIELD64(stats, xmit_tcp_segs), old->xmit_tcp_segs); - UPDATE_STATS_GB(stst->tcp.xmit_tcp_bytes, stats->xmit_tcp_bytes, + UPDATE_STATS_GB(stst->tcp.xmit_tcp_bytes, + IOMEM_GET_FIELD64(stats, xmit_tcp_bytes), old->xmit_tcp_bytes); - UPDATE_STATS_GB(stst->tcp.rcv_tcp_segs, stats->rcv_tcp_segs, + UPDATE_STATS_GB(stst->tcp.rcv_tcp_segs, + IOMEM_GET_FIELD64(stats, rcv
[PATCH 5/7] staging: slicoss: slicoss.c: fix different address space sparse warning
Signed-off-by: Peng Sun --- drivers/staging/slicoss/slicoss.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index c92b8c5..bf9b381 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -2230,7 +2230,7 @@ static int slic_if_init(struct adapter *adapter, unsigned long *flags) struct sliccard *card = adapter->card; struct net_device *dev = adapter->netdev; struct slic_shmemory *sm = >shmem; - struct slic_shmem_data *sm_data = sm->shmem_data; + struct slic_shmem_data __iomem *sm_data = sm->shmem_data; int rc; /* adapter should be down at this point */ @@ -2314,7 +2314,7 @@ static int slic_if_init(struct adapter *adapter, unsigned long *flags) /* *clear any pending events, then enable interrupts */ - sm_data->isr = 0; + IOMEM_SET_FIELD32(0, sm_data, isr); slic_write32(adapter, SLIC_REG_ISR, 0); slic_write32(adapter, SLIC_REG_ICR, ICR_INT_ON); -- 2.7.4
[PATCH 6/7] staging: slicoss: slicoss.c: fix different address space sparse warning
Signed-off-by: Peng Sun --- drivers/staging/slicoss/slicoss.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index bf9b381..59c4fbc 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -2603,7 +2603,7 @@ static void slic_config_pci(struct pci_dev *pcidev) static int slic_card_init(struct sliccard *card, struct adapter *adapter) { struct slic_shmemory *sm = >shmem; - struct slic_shmem_data *sm_data = sm->shmem_data; + struct slic_shmem_data __iomem *sm_data = sm->shmem_data; struct slic_eeprom *peeprom; struct oslic_eeprom *pOeeprom; dma_addr_t phys_config; @@ -2666,9 +2666,9 @@ static int slic_card_init(struct sliccard *card, struct adapter *adapter) } for (;;) { - if (sm_data->isr) { - if (sm_data->isr & ISR_UPC) { - sm_data->isr = 0; + if (IOMEM_GET_FIELD32(sm_data, isr)) { + if (IOMEM_GET_FIELD32(sm_data, isr) & ISR_UPC) { + IOMEM_SET_FIELD32(0, sm_data, isr); slic_write64(adapter, SLIC_REG_ISP, 0, 0); slic_write32(adapter, SLIC_REG_ISR, 0); @@ -2678,7 +2678,7 @@ static int slic_card_init(struct sliccard *card, struct adapter *adapter) break; } - sm_data->isr = 0; + IOMEM_SET_FIELD32(0, sm_data, isr); slic_write32(adapter, SLIC_REG_ISR, 0); slic_flush_write(adapter); } else { -- 2.7.4
[PATCH 7/7] staging: slicoss: slicoss.c: fix different address space sparse warning
Signed-off-by: Peng Sun --- drivers/staging/slicoss/slicoss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index 59c4fbc..abe7592 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -2883,7 +2883,7 @@ static int slic_init_adapter(struct net_device *netdev, if (!sm_data) return -ENOMEM; - sm->shmem_data = sm_data; + sm->shmem_data = (struct slic_shmem_data __force __iomem *)sm_data; sm->isr_phaddr = phaddr; sm->lnkstatus_phaddr = phaddr + offsetof(struct slic_shmem_data, lnkstatus); -- 2.7.4
[PATCH 0/7] staging: slicoss: fix different address space sparse warnings
commit-id d221eb9f14f9, "Add linux-next specific files for 20160909" add several macros to fix these warnings Peng Sun (7): staging: slicoss: slicoss.c: fix different address space sparse warning staging: slicoss: slicoss.c: fix different address space sparse warning staging: slicoss: slicoss.c: fix different address space sparse warning staging: slicoss: slicoss.c: fix different address space sparse warning staging: slicoss: slicoss.c: fix different address space sparse warning staging: slicoss: slicoss.c: fix different address space sparse warning staging: slicoss: slicoss.c: fix different address space sparse warning drivers/staging/slicoss/slic.h| 46 ++ drivers/staging/slicoss/slicoss.c | 82 +++ 2 files changed, 95 insertions(+), 33 deletions(-) -- 2.7.4
[PATCH 0/7] staging: slicoss: fix different address space sparse warnings
commit-id d221eb9f14f9, "Add linux-next specific files for 20160909" add several macros to fix these warnings Peng Sun (7): staging: slicoss: slicoss.c: fix different address space sparse warning staging: slicoss: slicoss.c: fix different address space sparse warning staging: slicoss: slicoss.c: fix different address space sparse warning staging: slicoss: slicoss.c: fix different address space sparse warning staging: slicoss: slicoss.c: fix different address space sparse warning staging: slicoss: slicoss.c: fix different address space sparse warning staging: slicoss: slicoss.c: fix different address space sparse warning drivers/staging/slicoss/slic.h| 46 ++ drivers/staging/slicoss/slicoss.c | 82 +++ 2 files changed, 95 insertions(+), 33 deletions(-) -- 2.7.4
[PATCH 1/7] staging: slicoss: slicoss.c: fix different address space sparse warning
add IOMEM_GET_FIELD32 to get u32 value of a member of a __iomem structure; Signed-off-by: Peng Sun <sironhide0n...@gmail.com> --- drivers/staging/slicoss/slic.h| 7 +++ drivers/staging/slicoss/slicoss.c | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h index fe1d2ce..022e7f6 100644 --- a/drivers/staging/slicoss/slic.h +++ b/drivers/staging/slicoss/slic.h @@ -539,6 +539,13 @@ static inline void slic_flush_write(struct adapter *adapter) ioread32(adapter->regs + SLIC_REG_HOSTID); } +#define IOMEM_GET_FIELD32(base, member) \ +({ \ + char __iomem *_base = (char __iomem *)base; \ + _base += offsetof(typeof(*base), member); \ + ioread32(_base);\ +}) + #define UPDATE_STATS(largestat, newstat, oldstat)\ {\ if ((newstat) < (oldstat)) \ diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index 21280a3..929a0d5 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -924,8 +924,8 @@ err_unlock_irq: static void slic_link_upr_complete(struct adapter *adapter, u32 isr) { struct slic_shmemory *sm = >shmem; - struct slic_shmem_data *sm_data = sm->shmem_data; - u32 lst = sm_data->lnkstatus; + struct slic_shmem_data __iomem *sm_data = sm->shmem_data; + u32 lst = IOMEM_GET_FIELD32(sm_data, lnkstatus); uint linkup; unsigned char linkspeed; unsigned char linkduplex; -- 2.7.4
[PATCH 1/7] staging: slicoss: slicoss.c: fix different address space sparse warning
add IOMEM_GET_FIELD32 to get u32 value of a member of a __iomem structure; Signed-off-by: Peng Sun --- drivers/staging/slicoss/slic.h| 7 +++ drivers/staging/slicoss/slicoss.c | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h index fe1d2ce..022e7f6 100644 --- a/drivers/staging/slicoss/slic.h +++ b/drivers/staging/slicoss/slic.h @@ -539,6 +539,13 @@ static inline void slic_flush_write(struct adapter *adapter) ioread32(adapter->regs + SLIC_REG_HOSTID); } +#define IOMEM_GET_FIELD32(base, member) \ +({ \ + char __iomem *_base = (char __iomem *)base; \ + _base += offsetof(typeof(*base), member); \ + ioread32(_base);\ +}) + #define UPDATE_STATS(largestat, newstat, oldstat)\ {\ if ((newstat) < (oldstat)) \ diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index 21280a3..929a0d5 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -924,8 +924,8 @@ err_unlock_irq: static void slic_link_upr_complete(struct adapter *adapter, u32 isr) { struct slic_shmemory *sm = >shmem; - struct slic_shmem_data *sm_data = sm->shmem_data; - u32 lst = sm_data->lnkstatus; + struct slic_shmem_data __iomem *sm_data = sm->shmem_data; + u32 lst = IOMEM_GET_FIELD32(sm_data, lnkstatus); uint linkup; unsigned char linkspeed; unsigned char linkduplex; -- 2.7.4
[PATCH 02/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELD32 to fix sparse warnings
Signed-off-by: Peng Sun <sironhide0n...@gmail.com> --- drivers/staging/slicoss/slic.h | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h index 7c23190..ff71070 100644 --- a/drivers/staging/slicoss/slic.h +++ b/drivers/staging/slicoss/slic.h @@ -546,6 +546,13 @@ static inline void slic_flush_write(struct adapter *adapter) (void __iomem *)_base; \ }) +#define IOMEM_GET_FIELD32(base, member) \ +({ \ + char __iomem *_base = (char __iomem *)base; \ + _base += offsetof(typeof(*base), member); \ + ioread32(_base);\ +}) + #define UPDATE_STATS(largestat, newstat, oldstat)\ {\ if ((newstat) < (oldstat)) \ -- 2.7.4
[PATCH 02/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELD32 to fix sparse warnings
Signed-off-by: Peng Sun --- drivers/staging/slicoss/slic.h | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h index 7c23190..ff71070 100644 --- a/drivers/staging/slicoss/slic.h +++ b/drivers/staging/slicoss/slic.h @@ -546,6 +546,13 @@ static inline void slic_flush_write(struct adapter *adapter) (void __iomem *)_base; \ }) +#define IOMEM_GET_FIELD32(base, member) \ +({ \ + char __iomem *_base = (char __iomem *)base; \ + _base += offsetof(typeof(*base), member); \ + ioread32(_base);\ +}) + #define UPDATE_STATS(largestat, newstat, oldstat)\ {\ if ((newstat) < (oldstat)) \ -- 2.7.4
[PATCH 03/10] staging: slicoss: slic.h: add a macro IOMEM_SET_FIELD32 to fix sparse warnings
Signed-off-by: Peng Sun <sironhide0n...@gmail.com> --- drivers/staging/slicoss/slic.h | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h index ff71070..4c22863 100644 --- a/drivers/staging/slicoss/slic.h +++ b/drivers/staging/slicoss/slic.h @@ -553,6 +553,13 @@ static inline void slic_flush_write(struct adapter *adapter) ioread32(_base);\ }) +#define IOMEM_SET_FIELD32(value, base, member) \ +({ \ + char __iomem *_base = (char __iomem *)base; \ + _base += offsetof(typeof(*base), member); \ + iowrite32(value, _base);\ +}) + #define UPDATE_STATS(largestat, newstat, oldstat)\ {\ if ((newstat) < (oldstat)) \ -- 2.7.4
[PATCH 06/10] staging: slicoss: slicoss.c: fix different address space sparse warning
Signed-off-by: Peng Sun <sironhide0n...@gmail.com> --- drivers/staging/slicoss/slicoss.c | 49 +-- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index 929a0d5..03b01c5 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -1004,8 +1004,9 @@ static void slic_upr_request_complete(struct adapter *adapter, u32 isr) switch (upr->upr_request) { case SLIC_UPR_STATS: { struct slic_shmemory *sm = >shmem; - struct slic_shmem_data *sm_data = sm->shmem_data; - struct slic_stats *stats = _data->stats; + struct slic_shmem_data __iomem *sm_data = sm->shmem_data; + struct slic_stats __iomem *stats = + IOMEM_GET_FIELDADDR(sm_data, stats); struct slic_stats *old = >inicstats_prev; struct slicnet_stats *stst = >slic_stats; @@ -1015,48 +1016,62 @@ static void slic_upr_request_complete(struct adapter *adapter, u32 isr) break; } - UPDATE_STATS_GB(stst->tcp.xmit_tcp_segs, stats->xmit_tcp_segs, + UPDATE_STATS_GB(stst->tcp.xmit_tcp_segs, + IOMEM_GET_FIELD64(stats, xmit_tcp_segs), old->xmit_tcp_segs); - UPDATE_STATS_GB(stst->tcp.xmit_tcp_bytes, stats->xmit_tcp_bytes, + UPDATE_STATS_GB(stst->tcp.xmit_tcp_bytes, + IOMEM_GET_FIELD64(stats, xmit_tcp_bytes), old->xmit_tcp_bytes); - UPDATE_STATS_GB(stst->tcp.rcv_tcp_segs, stats->rcv_tcp_segs, + UPDATE_STATS_GB(stst->tcp.rcv_tcp_segs, + IOMEM_GET_FIELD64(stats, rcv_tcp_segs), old->rcv_tcp_segs); - UPDATE_STATS_GB(stst->tcp.rcv_tcp_bytes, stats->rcv_tcp_bytes, + UPDATE_STATS_GB(stst->tcp.rcv_tcp_bytes, + IOMEM_GET_FIELD64(stats, rcv_tcp_bytes), old->rcv_tcp_bytes); - UPDATE_STATS_GB(stst->iface.xmt_bytes, stats->xmit_bytes, + UPDATE_STATS_GB(stst->iface.xmt_bytes, + IOMEM_GET_FIELD64(stats, xmit_bytes), old->xmit_bytes); - UPDATE_STATS_GB(stst->iface.xmt_ucast, stats->xmit_unicasts, + UPDATE_STATS_GB(stst->iface.xmt_ucast, + IOMEM_GET_FIELD64(stats, xmit_unicasts), old->xmit_unicasts); - UPDATE_STATS_GB(stst->iface.rcv_bytes, stats->rcv_bytes, + UPDATE_STATS_GB(stst->iface.rcv_bytes, + IOMEM_GET_FIELD64(stats, rcv_bytes), old->rcv_bytes); - UPDATE_STATS_GB(stst->iface.rcv_ucast, stats->rcv_unicasts, + UPDATE_STATS_GB(stst->iface.rcv_ucast, + IOMEM_GET_FIELD64(stats, rcv_unicasts), old->rcv_unicasts); - UPDATE_STATS_GB(stst->iface.xmt_errors, stats->xmit_collisions, + UPDATE_STATS_GB(stst->iface.xmt_errors, + IOMEM_GET_FIELD64(stats, xmit_collisions), old->xmit_collisions); UPDATE_STATS_GB(stst->iface.xmt_errors, - stats->xmit_excess_collisions, + IOMEM_GET_FIELD64(stats, + xmit_excess_collisions), old->xmit_excess_collisions); - UPDATE_STATS_GB(stst->iface.xmt_errors, stats->xmit_other_error, + UPDATE_STATS_GB(stst->iface.xmt_errors, + IOMEM_GET_FIELD64(stats, xmit_other_error), old->xmit_other_error); - UPDATE_STATS_GB(stst->iface.rcv_errors, stats->rcv_other_error, + UPDATE_STATS_GB(stst->iface.rcv_errors, + IOMEM_GET_FIELD64(stats, rcv_other_error), old->rcv_other_error); - UPDATE_STATS_GB(stst->iface.rcv_discards, stats->rcv_drops, + UPDATE_STATS_GB(stst->iface.rcv_discards, + IOMEM_GET_FIELD64(stats, rcv_drops), old->rcv_drops); - if (stats->rcv_drops > old->rcv_drops) - adapter->rcv_drops += (stats->rcv_drops -
[PATCH 03/10] staging: slicoss: slic.h: add a macro IOMEM_SET_FIELD32 to fix sparse warnings
Signed-off-by: Peng Sun --- drivers/staging/slicoss/slic.h | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h index ff71070..4c22863 100644 --- a/drivers/staging/slicoss/slic.h +++ b/drivers/staging/slicoss/slic.h @@ -553,6 +553,13 @@ static inline void slic_flush_write(struct adapter *adapter) ioread32(_base);\ }) +#define IOMEM_SET_FIELD32(value, base, member) \ +({ \ + char __iomem *_base = (char __iomem *)base; \ + _base += offsetof(typeof(*base), member); \ + iowrite32(value, _base);\ +}) + #define UPDATE_STATS(largestat, newstat, oldstat)\ {\ if ((newstat) < (oldstat)) \ -- 2.7.4
[PATCH 06/10] staging: slicoss: slicoss.c: fix different address space sparse warning
Signed-off-by: Peng Sun --- drivers/staging/slicoss/slicoss.c | 49 +-- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index 929a0d5..03b01c5 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -1004,8 +1004,9 @@ static void slic_upr_request_complete(struct adapter *adapter, u32 isr) switch (upr->upr_request) { case SLIC_UPR_STATS: { struct slic_shmemory *sm = >shmem; - struct slic_shmem_data *sm_data = sm->shmem_data; - struct slic_stats *stats = _data->stats; + struct slic_shmem_data __iomem *sm_data = sm->shmem_data; + struct slic_stats __iomem *stats = + IOMEM_GET_FIELDADDR(sm_data, stats); struct slic_stats *old = >inicstats_prev; struct slicnet_stats *stst = >slic_stats; @@ -1015,48 +1016,62 @@ static void slic_upr_request_complete(struct adapter *adapter, u32 isr) break; } - UPDATE_STATS_GB(stst->tcp.xmit_tcp_segs, stats->xmit_tcp_segs, + UPDATE_STATS_GB(stst->tcp.xmit_tcp_segs, + IOMEM_GET_FIELD64(stats, xmit_tcp_segs), old->xmit_tcp_segs); - UPDATE_STATS_GB(stst->tcp.xmit_tcp_bytes, stats->xmit_tcp_bytes, + UPDATE_STATS_GB(stst->tcp.xmit_tcp_bytes, + IOMEM_GET_FIELD64(stats, xmit_tcp_bytes), old->xmit_tcp_bytes); - UPDATE_STATS_GB(stst->tcp.rcv_tcp_segs, stats->rcv_tcp_segs, + UPDATE_STATS_GB(stst->tcp.rcv_tcp_segs, + IOMEM_GET_FIELD64(stats, rcv_tcp_segs), old->rcv_tcp_segs); - UPDATE_STATS_GB(stst->tcp.rcv_tcp_bytes, stats->rcv_tcp_bytes, + UPDATE_STATS_GB(stst->tcp.rcv_tcp_bytes, + IOMEM_GET_FIELD64(stats, rcv_tcp_bytes), old->rcv_tcp_bytes); - UPDATE_STATS_GB(stst->iface.xmt_bytes, stats->xmit_bytes, + UPDATE_STATS_GB(stst->iface.xmt_bytes, + IOMEM_GET_FIELD64(stats, xmit_bytes), old->xmit_bytes); - UPDATE_STATS_GB(stst->iface.xmt_ucast, stats->xmit_unicasts, + UPDATE_STATS_GB(stst->iface.xmt_ucast, + IOMEM_GET_FIELD64(stats, xmit_unicasts), old->xmit_unicasts); - UPDATE_STATS_GB(stst->iface.rcv_bytes, stats->rcv_bytes, + UPDATE_STATS_GB(stst->iface.rcv_bytes, + IOMEM_GET_FIELD64(stats, rcv_bytes), old->rcv_bytes); - UPDATE_STATS_GB(stst->iface.rcv_ucast, stats->rcv_unicasts, + UPDATE_STATS_GB(stst->iface.rcv_ucast, + IOMEM_GET_FIELD64(stats, rcv_unicasts), old->rcv_unicasts); - UPDATE_STATS_GB(stst->iface.xmt_errors, stats->xmit_collisions, + UPDATE_STATS_GB(stst->iface.xmt_errors, + IOMEM_GET_FIELD64(stats, xmit_collisions), old->xmit_collisions); UPDATE_STATS_GB(stst->iface.xmt_errors, - stats->xmit_excess_collisions, + IOMEM_GET_FIELD64(stats, + xmit_excess_collisions), old->xmit_excess_collisions); - UPDATE_STATS_GB(stst->iface.xmt_errors, stats->xmit_other_error, + UPDATE_STATS_GB(stst->iface.xmt_errors, + IOMEM_GET_FIELD64(stats, xmit_other_error), old->xmit_other_error); - UPDATE_STATS_GB(stst->iface.rcv_errors, stats->rcv_other_error, + UPDATE_STATS_GB(stst->iface.rcv_errors, + IOMEM_GET_FIELD64(stats, rcv_other_error), old->rcv_other_error); - UPDATE_STATS_GB(stst->iface.rcv_discards, stats->rcv_drops, + UPDATE_STATS_GB(stst->iface.rcv_discards, + IOMEM_GET_FIELD64(stats, rcv_drops), old->rcv_drops); - if (stats->rcv_drops > old->rcv_drops) - adapter->rcv_drops += (stats->rcv_drops - + if (IOMEM_GET_FIELD64(stats, rcv_drops) > old->rc
[PATCH 09/10] staging: slicoss: slicoss.c: fix different address space sparse warning
Signed-off-by: Peng Sun <sironhide0n...@gmail.com> --- drivers/staging/slicoss/slicoss.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index a2d9c77..6ecf71c 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -2230,7 +2230,7 @@ static int slic_if_init(struct adapter *adapter, unsigned long *flags) struct sliccard *card = adapter->card; struct net_device *dev = adapter->netdev; struct slic_shmemory *sm = >shmem; - struct slic_shmem_data *sm_data = sm->shmem_data; + struct slic_shmem_data __iomem *sm_data = sm->shmem_data; int rc; /* adapter should be down at this point */ @@ -2314,7 +2314,7 @@ static int slic_if_init(struct adapter *adapter, unsigned long *flags) /* *clear any pending events, then enable interrupts */ - sm_data->isr = 0; + IOMEM_SET_FIELD32(0, sm_data, isr); slic_write32(adapter, SLIC_REG_ISR, 0); slic_write32(adapter, SLIC_REG_ICR, ICR_INT_ON); @@ -2603,7 +2603,7 @@ static void slic_config_pci(struct pci_dev *pcidev) static int slic_card_init(struct sliccard *card, struct adapter *adapter) { struct slic_shmemory *sm = >shmem; - struct slic_shmem_data *sm_data = sm->shmem_data; + struct slic_shmem_data __iomem *sm_data = sm->shmem_data; struct slic_eeprom *peeprom; struct oslic_eeprom *pOeeprom; dma_addr_t phys_config; @@ -2666,9 +2666,9 @@ static int slic_card_init(struct sliccard *card, struct adapter *adapter) } for (;;) { - if (sm_data->isr) { - if (sm_data->isr & ISR_UPC) { - sm_data->isr = 0; + if (IOMEM_GET_FIELD32(sm_data, isr)) { + if (IOMEM_GET_FIELD32(sm_data, isr) & ISR_UPC) { + IOMEM_SET_FIELD32(0, sm_data, isr); slic_write64(adapter, SLIC_REG_ISP, 0, 0); slic_write32(adapter, SLIC_REG_ISR, 0); @@ -2678,7 +2678,7 @@ static int slic_card_init(struct sliccard *card, struct adapter *adapter) break; } - sm_data->isr = 0; + IOMEM_SET_FIELD32(0, sm_data, isr); slic_write32(adapter, SLIC_REG_ISR, 0); slic_flush_write(adapter); } else { -- 2.7.4
[PATCH 07/10] staging: slicoss: slicoss.c: fix different address space sparse warning
Signed-off-by: Peng Sun <sironhide0n...@gmail.com> --- drivers/staging/slicoss/slicoss.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index 03b01c5..2097d64 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -1697,9 +1697,10 @@ static void slic_init_cleanup(struct adapter *adapter) if (adapter->shmem.shmem_data) { struct slic_shmemory *sm = >shmem; - struct slic_shmem_data *sm_data = sm->shmem_data; + struct slic_shmem_data __iomem *sm_data = sm->shmem_data; - pci_free_consistent(adapter->pcidev, sizeof(*sm_data), sm_data, + pci_free_consistent(adapter->pcidev, sizeof(*sm_data), + (void __force *)sm_data, sm->isr_phaddr); } -- 2.7.4
[PATCH 10/10] staging: slicoss: slicoss.c: fix different address space sparse warning
Signed-off-by: Peng Sun <sironhide0n...@gmail.com> --- drivers/staging/slicoss/slicoss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index 6ecf71c..e94dbd4 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -2883,7 +2883,7 @@ static int slic_init_adapter(struct net_device *netdev, if (!sm_data) return -ENOMEM; - sm->shmem_data = sm_data; + sm->shmem_data = (struct slic_shmem_data __force __iomem *)sm_data; sm->isr_phaddr = phaddr; sm->lnkstatus_phaddr = phaddr + offsetof(struct slic_shmem_data, lnkstatus); -- 2.7.4
[PATCH 08/10] staging: slicoss: slicoss.c: fix different address space sparse warning
Signed-off-by: Peng Sun <sironhide0n...@gmail.com> --- drivers/staging/slicoss/slicoss.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index 2097d64..a2d9c77 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -2087,15 +2087,15 @@ static irqreturn_t slic_interrupt(int irq, void *dev_id) struct net_device *dev = dev_id; struct adapter *adapter = netdev_priv(dev); struct slic_shmemory *sm = >shmem; - struct slic_shmem_data *sm_data = sm->shmem_data; + struct slic_shmem_data __iomem *sm_data = sm->shmem_data; u32 isr; - if (sm_data->isr) { + if (IOMEM_GET_FIELD32(sm_data, isr)) { slic_write32(adapter, SLIC_REG_ICR, ICR_INT_MASK); slic_flush_write(adapter); - isr = sm_data->isr; - sm_data->isr = 0; + isr = IOMEM_GET_FIELD32(sm_data, isr); + IOMEM_SET_FIELD32(0, sm_data, isr); adapter->num_isrs++; switch (adapter->card->state) { case CARD_UP: -- 2.7.4
[PATCH 09/10] staging: slicoss: slicoss.c: fix different address space sparse warning
Signed-off-by: Peng Sun --- drivers/staging/slicoss/slicoss.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index a2d9c77..6ecf71c 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -2230,7 +2230,7 @@ static int slic_if_init(struct adapter *adapter, unsigned long *flags) struct sliccard *card = adapter->card; struct net_device *dev = adapter->netdev; struct slic_shmemory *sm = >shmem; - struct slic_shmem_data *sm_data = sm->shmem_data; + struct slic_shmem_data __iomem *sm_data = sm->shmem_data; int rc; /* adapter should be down at this point */ @@ -2314,7 +2314,7 @@ static int slic_if_init(struct adapter *adapter, unsigned long *flags) /* *clear any pending events, then enable interrupts */ - sm_data->isr = 0; + IOMEM_SET_FIELD32(0, sm_data, isr); slic_write32(adapter, SLIC_REG_ISR, 0); slic_write32(adapter, SLIC_REG_ICR, ICR_INT_ON); @@ -2603,7 +2603,7 @@ static void slic_config_pci(struct pci_dev *pcidev) static int slic_card_init(struct sliccard *card, struct adapter *adapter) { struct slic_shmemory *sm = >shmem; - struct slic_shmem_data *sm_data = sm->shmem_data; + struct slic_shmem_data __iomem *sm_data = sm->shmem_data; struct slic_eeprom *peeprom; struct oslic_eeprom *pOeeprom; dma_addr_t phys_config; @@ -2666,9 +2666,9 @@ static int slic_card_init(struct sliccard *card, struct adapter *adapter) } for (;;) { - if (sm_data->isr) { - if (sm_data->isr & ISR_UPC) { - sm_data->isr = 0; + if (IOMEM_GET_FIELD32(sm_data, isr)) { + if (IOMEM_GET_FIELD32(sm_data, isr) & ISR_UPC) { + IOMEM_SET_FIELD32(0, sm_data, isr); slic_write64(adapter, SLIC_REG_ISP, 0, 0); slic_write32(adapter, SLIC_REG_ISR, 0); @@ -2678,7 +2678,7 @@ static int slic_card_init(struct sliccard *card, struct adapter *adapter) break; } - sm_data->isr = 0; + IOMEM_SET_FIELD32(0, sm_data, isr); slic_write32(adapter, SLIC_REG_ISR, 0); slic_flush_write(adapter); } else { -- 2.7.4
[PATCH 07/10] staging: slicoss: slicoss.c: fix different address space sparse warning
Signed-off-by: Peng Sun --- drivers/staging/slicoss/slicoss.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index 03b01c5..2097d64 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -1697,9 +1697,10 @@ static void slic_init_cleanup(struct adapter *adapter) if (adapter->shmem.shmem_data) { struct slic_shmemory *sm = >shmem; - struct slic_shmem_data *sm_data = sm->shmem_data; + struct slic_shmem_data __iomem *sm_data = sm->shmem_data; - pci_free_consistent(adapter->pcidev, sizeof(*sm_data), sm_data, + pci_free_consistent(adapter->pcidev, sizeof(*sm_data), + (void __force *)sm_data, sm->isr_phaddr); } -- 2.7.4
[PATCH 10/10] staging: slicoss: slicoss.c: fix different address space sparse warning
Signed-off-by: Peng Sun --- drivers/staging/slicoss/slicoss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index 6ecf71c..e94dbd4 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -2883,7 +2883,7 @@ static int slic_init_adapter(struct net_device *netdev, if (!sm_data) return -ENOMEM; - sm->shmem_data = sm_data; + sm->shmem_data = (struct slic_shmem_data __force __iomem *)sm_data; sm->isr_phaddr = phaddr; sm->lnkstatus_phaddr = phaddr + offsetof(struct slic_shmem_data, lnkstatus); -- 2.7.4
[PATCH 08/10] staging: slicoss: slicoss.c: fix different address space sparse warning
Signed-off-by: Peng Sun --- drivers/staging/slicoss/slicoss.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index 2097d64..a2d9c77 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -2087,15 +2087,15 @@ static irqreturn_t slic_interrupt(int irq, void *dev_id) struct net_device *dev = dev_id; struct adapter *adapter = netdev_priv(dev); struct slic_shmemory *sm = >shmem; - struct slic_shmem_data *sm_data = sm->shmem_data; + struct slic_shmem_data __iomem *sm_data = sm->shmem_data; u32 isr; - if (sm_data->isr) { + if (IOMEM_GET_FIELD32(sm_data, isr)) { slic_write32(adapter, SLIC_REG_ICR, ICR_INT_MASK); slic_flush_write(adapter); - isr = sm_data->isr; - sm_data->isr = 0; + isr = IOMEM_GET_FIELD32(sm_data, isr); + IOMEM_SET_FIELD32(0, sm_data, isr); adapter->num_isrs++; switch (adapter->card->state) { case CARD_UP: -- 2.7.4
[PATCH 04/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELD64 to fix sparse warnings
Signed-off-by: Peng Sun <sironhide0n...@gmail.com> --- drivers/staging/slicoss/slic.h | 25 + 1 file changed, 25 insertions(+) diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h index 4c22863..b9595c4 100644 --- a/drivers/staging/slicoss/slic.h +++ b/drivers/staging/slicoss/slic.h @@ -560,6 +560,31 @@ static inline void slic_flush_write(struct adapter *adapter) iowrite32(value, _base);\ }) +#ifdef CONFIG_64BIT +#define IOMEM_GET_FIELD64(base, member) \ +({ \ + char __iomem *_base = (char __iomem *)base; \ + _base += offsetof(typeof(*base), member); \ + readq(_base); \ +}) +#else +#define IOMEM_GET_FIELD64(base, member) \ +({ \ + char __iomem *_base = (char __iomem *)base; \ + u64 val;\ + _base += offsetof(typeof(*base), member); \ + val = ((u64)ioread8(_base + 7)) << 56; \ + val += ((u64)ioread8(_base + 6)) << 48; \ + val += ((u64)ioread8(_base + 5)) << 40; \ + val += ((u64)ioread8(_base + 4)) << 32; \ + val += ((u64)ioread8(_base + 3)) << 24; \ + val += ((u64)ioread8(_base + 2)) << 16; \ + val += ((u64)ioread8(_base + 1)) << 8; \ + val += ioread8(_base); \ + le64_to_cpu(val); \ +}) +#endif + #define UPDATE_STATS(largestat, newstat, oldstat)\ {\ if ((newstat) < (oldstat)) \ -- 2.7.4
[PATCH 05/10] staging: slicoss: slicoss.c: fix different address space sparse warning
Signed-off-by: Peng Sun <sironhide0n...@gmail.com> --- drivers/staging/slicoss/slicoss.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index 21280a3..929a0d5 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -924,8 +924,8 @@ err_unlock_irq: static void slic_link_upr_complete(struct adapter *adapter, u32 isr) { struct slic_shmemory *sm = >shmem; - struct slic_shmem_data *sm_data = sm->shmem_data; - u32 lst = sm_data->lnkstatus; + struct slic_shmem_data __iomem *sm_data = sm->shmem_data; + u32 lst = IOMEM_GET_FIELD32(sm_data, lnkstatus); uint linkup; unsigned char linkspeed; unsigned char linkduplex; -- 2.7.4
[PATCH 04/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELD64 to fix sparse warnings
Signed-off-by: Peng Sun --- drivers/staging/slicoss/slic.h | 25 + 1 file changed, 25 insertions(+) diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h index 4c22863..b9595c4 100644 --- a/drivers/staging/slicoss/slic.h +++ b/drivers/staging/slicoss/slic.h @@ -560,6 +560,31 @@ static inline void slic_flush_write(struct adapter *adapter) iowrite32(value, _base);\ }) +#ifdef CONFIG_64BIT +#define IOMEM_GET_FIELD64(base, member) \ +({ \ + char __iomem *_base = (char __iomem *)base; \ + _base += offsetof(typeof(*base), member); \ + readq(_base); \ +}) +#else +#define IOMEM_GET_FIELD64(base, member) \ +({ \ + char __iomem *_base = (char __iomem *)base; \ + u64 val;\ + _base += offsetof(typeof(*base), member); \ + val = ((u64)ioread8(_base + 7)) << 56; \ + val += ((u64)ioread8(_base + 6)) << 48; \ + val += ((u64)ioread8(_base + 5)) << 40; \ + val += ((u64)ioread8(_base + 4)) << 32; \ + val += ((u64)ioread8(_base + 3)) << 24; \ + val += ((u64)ioread8(_base + 2)) << 16; \ + val += ((u64)ioread8(_base + 1)) << 8; \ + val += ioread8(_base); \ + le64_to_cpu(val); \ +}) +#endif + #define UPDATE_STATS(largestat, newstat, oldstat)\ {\ if ((newstat) < (oldstat)) \ -- 2.7.4
[PATCH 05/10] staging: slicoss: slicoss.c: fix different address space sparse warning
Signed-off-by: Peng Sun --- drivers/staging/slicoss/slicoss.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index 21280a3..929a0d5 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -924,8 +924,8 @@ err_unlock_irq: static void slic_link_upr_complete(struct adapter *adapter, u32 isr) { struct slic_shmemory *sm = >shmem; - struct slic_shmem_data *sm_data = sm->shmem_data; - u32 lst = sm_data->lnkstatus; + struct slic_shmem_data __iomem *sm_data = sm->shmem_data; + u32 lst = IOMEM_GET_FIELD32(sm_data, lnkstatus); uint linkup; unsigned char linkspeed; unsigned char linkduplex; -- 2.7.4
[PATCH 01/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELDADDR to fix sparse warnings
Signed-off-by: Peng Sun <sironhide0n...@gmail.com> --- drivers/staging/slicoss/slic.h | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h index fe1d2ce..7c23190 100644 --- a/drivers/staging/slicoss/slic.h +++ b/drivers/staging/slicoss/slic.h @@ -539,6 +539,13 @@ static inline void slic_flush_write(struct adapter *adapter) ioread32(adapter->regs + SLIC_REG_HOSTID); } +#define IOMEM_GET_FIELDADDR(base, member) \ +({ \ + char __iomem *_base = (char __iomem *)base; \ + _base += offsetof(typeof(*base), member); \ + (void __iomem *)_base; \ +}) + #define UPDATE_STATS(largestat, newstat, oldstat)\ {\ if ((newstat) < (oldstat)) \ -- 2.7.4
[PATCH 01/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELDADDR to fix sparse warnings
Signed-off-by: Peng Sun --- drivers/staging/slicoss/slic.h | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h index fe1d2ce..7c23190 100644 --- a/drivers/staging/slicoss/slic.h +++ b/drivers/staging/slicoss/slic.h @@ -539,6 +539,13 @@ static inline void slic_flush_write(struct adapter *adapter) ioread32(adapter->regs + SLIC_REG_HOSTID); } +#define IOMEM_GET_FIELDADDR(base, member) \ +({ \ + char __iomem *_base = (char __iomem *)base; \ + _base += offsetof(typeof(*base), member); \ + (void __iomem *)_base; \ +}) + #define UPDATE_STATS(largestat, newstat, oldstat)\ {\ if ((newstat) < (oldstat)) \ -- 2.7.4
[PATCH 00/10] staging: slicoss: fix different address space sparse warnings
base commit-id d221eb9f14f9 Peng Sun (10): staging: slicoss: slic.h: add a macro IOMEM_GET_FIELDADDR to fix sparse warnings staging: slicoss: slic.h: add a macro IOMEM_GET_FIELD32 to fix sparse warnings staging: slicoss: slic.h: add a macro IOMEM_SET_FIELD32 to fix sparse warnings staging: slicoss: slic.h: add a macro IOMEM_GET_FIELD64 to fix sparse warnings staging: slicoss: slicoss.c: fix different address space sparse warning staging: slicoss: slicoss.c: fix different address space sparse warning staging: slicoss: slicoss.c: fix different address space sparse warning staging: slicoss: slicoss.c: fix different address space sparse warning staging: slicoss: slicoss.c: fix different address space sparse warning staging: slicoss: slicoss.c: fix different address space sparse warning drivers/staging/slicoss/slic.h| 46 ++ drivers/staging/slicoss/slicoss.c | 82 +++ 2 files changed, 95 insertions(+), 33 deletions(-) -- 2.7.4
[PATCH 00/10] staging: slicoss: fix different address space sparse warnings
base commit-id d221eb9f14f9 Peng Sun (10): staging: slicoss: slic.h: add a macro IOMEM_GET_FIELDADDR to fix sparse warnings staging: slicoss: slic.h: add a macro IOMEM_GET_FIELD32 to fix sparse warnings staging: slicoss: slic.h: add a macro IOMEM_SET_FIELD32 to fix sparse warnings staging: slicoss: slic.h: add a macro IOMEM_GET_FIELD64 to fix sparse warnings staging: slicoss: slicoss.c: fix different address space sparse warning staging: slicoss: slicoss.c: fix different address space sparse warning staging: slicoss: slicoss.c: fix different address space sparse warning staging: slicoss: slicoss.c: fix different address space sparse warning staging: slicoss: slicoss.c: fix different address space sparse warning staging: slicoss: slicoss.c: fix different address space sparse warning drivers/staging/slicoss/slic.h| 46 ++ drivers/staging/slicoss/slicoss.c | 82 +++ 2 files changed, 95 insertions(+), 33 deletions(-) -- 2.7.4
[PATCH 1/2] staging: slicoss: slic.h: add several macros to fix sparse warnings
Signed-off-by: Peng Sun <sironhide0n...@gmail.com> --- drivers/staging/slicoss/slic.h | 45 ++ 1 file changed, 45 insertions(+) diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h index fe1d2ce..cfed4ef 100644 --- a/drivers/staging/slicoss/slic.h +++ b/drivers/staging/slicoss/slic.h @@ -539,6 +539,51 @@ static inline void slic_flush_write(struct adapter *adapter) ioread32(adapter->regs + SLIC_REG_HOSTID); } +#define IOMEM_GET_FIELDADDR(base, member) \ +({ \ + char __iomem *_base = (char __iomem *)base; \ + _base += offsetof(typeof(*base), member); \ + (void __iomem *)_base; \ +}) + +#define IOMEM_GET_FIELD32(base, member) \ +({ \ + char __iomem *_base = (char __iomem *)base; \ + _base += offsetof(typeof(*base), member); \ + ioread32(_base);\ +}) + +#define IOMEM_SET_FIELD32(value, base, member) \ +({ \ + char __iomem *_base = (char __iomem *)base; \ + _base += offsetof(typeof(*base), member); \ + iowrite32(value, _base);\ +}) + +#ifdef CONFIG_64BIT +#define IOMEM_GET_FIELD64(base, member) \ +({ \ + char __iomem *_base = (char __iomem *)base; \ + _base += offsetof(typeof(*base), member); \ + readq(_base); \ +}) +#else +#define IOMEM_GET_FIELD64(base, member) \ +({ \ + char __iomem *_base = (char __iomem *)base; \ + _base += offsetof(typeof(*base), member); \ + u64 val = ((u64)ioread8(_base + 7)) << 56; \ + val += ((u64)ioread8(_base + 6)) << 48; \ + val += ((u64)ioread8(_base + 5)) << 40; \ + val += ((u64)ioread8(_base + 4)) << 32; \ + val += ((u64)ioread8(_base + 3)) << 24; \ + val += ((u64)ioread8(_base + 2)) << 16; \ + val += ((u64)ioread8(_base + 1)) << 8; \ + val += ioread8(_base); \ + le64_to_cpu(val); \ +}) +#endif + #define UPDATE_STATS(largestat, newstat, oldstat)\ {\ if ((newstat) < (oldstat)) \ -- 2.7.4
[PATCH 1/2] staging: slicoss: slic.h: add several macros to fix sparse warnings
Signed-off-by: Peng Sun --- drivers/staging/slicoss/slic.h | 45 ++ 1 file changed, 45 insertions(+) diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h index fe1d2ce..cfed4ef 100644 --- a/drivers/staging/slicoss/slic.h +++ b/drivers/staging/slicoss/slic.h @@ -539,6 +539,51 @@ static inline void slic_flush_write(struct adapter *adapter) ioread32(adapter->regs + SLIC_REG_HOSTID); } +#define IOMEM_GET_FIELDADDR(base, member) \ +({ \ + char __iomem *_base = (char __iomem *)base; \ + _base += offsetof(typeof(*base), member); \ + (void __iomem *)_base; \ +}) + +#define IOMEM_GET_FIELD32(base, member) \ +({ \ + char __iomem *_base = (char __iomem *)base; \ + _base += offsetof(typeof(*base), member); \ + ioread32(_base);\ +}) + +#define IOMEM_SET_FIELD32(value, base, member) \ +({ \ + char __iomem *_base = (char __iomem *)base; \ + _base += offsetof(typeof(*base), member); \ + iowrite32(value, _base);\ +}) + +#ifdef CONFIG_64BIT +#define IOMEM_GET_FIELD64(base, member) \ +({ \ + char __iomem *_base = (char __iomem *)base; \ + _base += offsetof(typeof(*base), member); \ + readq(_base); \ +}) +#else +#define IOMEM_GET_FIELD64(base, member) \ +({ \ + char __iomem *_base = (char __iomem *)base; \ + _base += offsetof(typeof(*base), member); \ + u64 val = ((u64)ioread8(_base + 7)) << 56; \ + val += ((u64)ioread8(_base + 6)) << 48; \ + val += ((u64)ioread8(_base + 5)) << 40; \ + val += ((u64)ioread8(_base + 4)) << 32; \ + val += ((u64)ioread8(_base + 3)) << 24; \ + val += ((u64)ioread8(_base + 2)) << 16; \ + val += ((u64)ioread8(_base + 1)) << 8; \ + val += ioread8(_base); \ + le64_to_cpu(val); \ +}) +#endif + #define UPDATE_STATS(largestat, newstat, oldstat)\ {\ if ((newstat) < (oldstat)) \ -- 2.7.4
[PATCH 2/2] staging: slicoss: slicoss.c: fix different address space sparse warnings
Signed-off-by: Peng Sun <sironhide0n...@gmail.com> --- drivers/staging/slicoss/slicoss.c | 82 +++ 1 file changed, 49 insertions(+), 33 deletions(-) diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index 21280a3..abe7592 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -924,8 +924,8 @@ err_unlock_irq: static void slic_link_upr_complete(struct adapter *adapter, u32 isr) { struct slic_shmemory *sm = >shmem; - struct slic_shmem_data *sm_data = sm->shmem_data; - u32 lst = sm_data->lnkstatus; + struct slic_shmem_data __iomem *sm_data = sm->shmem_data; + u32 lst = IOMEM_GET_FIELD32(sm_data, lnkstatus); uint linkup; unsigned char linkspeed; unsigned char linkduplex; @@ -1004,8 +1004,9 @@ static void slic_upr_request_complete(struct adapter *adapter, u32 isr) switch (upr->upr_request) { case SLIC_UPR_STATS: { struct slic_shmemory *sm = >shmem; - struct slic_shmem_data *sm_data = sm->shmem_data; - struct slic_stats *stats = _data->stats; + struct slic_shmem_data __iomem *sm_data = sm->shmem_data; + struct slic_stats __iomem *stats = + IOMEM_GET_FIELDADDR(sm_data, stats); struct slic_stats *old = >inicstats_prev; struct slicnet_stats *stst = >slic_stats; @@ -1015,48 +1016,62 @@ static void slic_upr_request_complete(struct adapter *adapter, u32 isr) break; } - UPDATE_STATS_GB(stst->tcp.xmit_tcp_segs, stats->xmit_tcp_segs, + UPDATE_STATS_GB(stst->tcp.xmit_tcp_segs, + IOMEM_GET_FIELD64(stats, xmit_tcp_segs), old->xmit_tcp_segs); - UPDATE_STATS_GB(stst->tcp.xmit_tcp_bytes, stats->xmit_tcp_bytes, + UPDATE_STATS_GB(stst->tcp.xmit_tcp_bytes, + IOMEM_GET_FIELD64(stats, xmit_tcp_bytes), old->xmit_tcp_bytes); - UPDATE_STATS_GB(stst->tcp.rcv_tcp_segs, stats->rcv_tcp_segs, + UPDATE_STATS_GB(stst->tcp.rcv_tcp_segs, + IOMEM_GET_FIELD64(stats, rcv_tcp_segs), old->rcv_tcp_segs); - UPDATE_STATS_GB(stst->tcp.rcv_tcp_bytes, stats->rcv_tcp_bytes, + UPDATE_STATS_GB(stst->tcp.rcv_tcp_bytes, + IOMEM_GET_FIELD64(stats, rcv_tcp_bytes), old->rcv_tcp_bytes); - UPDATE_STATS_GB(stst->iface.xmt_bytes, stats->xmit_bytes, + UPDATE_STATS_GB(stst->iface.xmt_bytes, + IOMEM_GET_FIELD64(stats, xmit_bytes), old->xmit_bytes); - UPDATE_STATS_GB(stst->iface.xmt_ucast, stats->xmit_unicasts, + UPDATE_STATS_GB(stst->iface.xmt_ucast, + IOMEM_GET_FIELD64(stats, xmit_unicasts), old->xmit_unicasts); - UPDATE_STATS_GB(stst->iface.rcv_bytes, stats->rcv_bytes, + UPDATE_STATS_GB(stst->iface.rcv_bytes, + IOMEM_GET_FIELD64(stats, rcv_bytes), old->rcv_bytes); - UPDATE_STATS_GB(stst->iface.rcv_ucast, stats->rcv_unicasts, + UPDATE_STATS_GB(stst->iface.rcv_ucast, + IOMEM_GET_FIELD64(stats, rcv_unicasts), old->rcv_unicasts); - UPDATE_STATS_GB(stst->iface.xmt_errors, stats->xmit_collisions, + UPDATE_STATS_GB(stst->iface.xmt_errors, + IOMEM_GET_FIELD64(stats, xmit_collisions), old->xmit_collisions); UPDATE_STATS_GB(stst->iface.xmt_errors, - stats->xmit_excess_collisions, + IOMEM_GET_FIELD64(stats, + xmit_excess_collisions), old->xmit_excess_collisions); - UPDATE_STATS_GB(stst->iface.xmt_errors, stats->xmit_other_error, + UPDATE_STATS_GB(stst->iface.xmt_errors, + IOMEM_GET_FIELD64(stats, xmit_other_error), old->xmit_other_error); - UPDATE_STATS_GB(stst->iface.rcv_errors, stats->rcv_other_error, + UPDATE_STATS_GB(stst->iface.rcv_errors, + IOMEM_GET_FIELD64(stats, rcv_other_error),
[PATCH 2/2] staging: slicoss: slicoss.c: fix different address space sparse warnings
Signed-off-by: Peng Sun --- drivers/staging/slicoss/slicoss.c | 82 +++ 1 file changed, 49 insertions(+), 33 deletions(-) diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index 21280a3..abe7592 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -924,8 +924,8 @@ err_unlock_irq: static void slic_link_upr_complete(struct adapter *adapter, u32 isr) { struct slic_shmemory *sm = >shmem; - struct slic_shmem_data *sm_data = sm->shmem_data; - u32 lst = sm_data->lnkstatus; + struct slic_shmem_data __iomem *sm_data = sm->shmem_data; + u32 lst = IOMEM_GET_FIELD32(sm_data, lnkstatus); uint linkup; unsigned char linkspeed; unsigned char linkduplex; @@ -1004,8 +1004,9 @@ static void slic_upr_request_complete(struct adapter *adapter, u32 isr) switch (upr->upr_request) { case SLIC_UPR_STATS: { struct slic_shmemory *sm = >shmem; - struct slic_shmem_data *sm_data = sm->shmem_data; - struct slic_stats *stats = _data->stats; + struct slic_shmem_data __iomem *sm_data = sm->shmem_data; + struct slic_stats __iomem *stats = + IOMEM_GET_FIELDADDR(sm_data, stats); struct slic_stats *old = >inicstats_prev; struct slicnet_stats *stst = >slic_stats; @@ -1015,48 +1016,62 @@ static void slic_upr_request_complete(struct adapter *adapter, u32 isr) break; } - UPDATE_STATS_GB(stst->tcp.xmit_tcp_segs, stats->xmit_tcp_segs, + UPDATE_STATS_GB(stst->tcp.xmit_tcp_segs, + IOMEM_GET_FIELD64(stats, xmit_tcp_segs), old->xmit_tcp_segs); - UPDATE_STATS_GB(stst->tcp.xmit_tcp_bytes, stats->xmit_tcp_bytes, + UPDATE_STATS_GB(stst->tcp.xmit_tcp_bytes, + IOMEM_GET_FIELD64(stats, xmit_tcp_bytes), old->xmit_tcp_bytes); - UPDATE_STATS_GB(stst->tcp.rcv_tcp_segs, stats->rcv_tcp_segs, + UPDATE_STATS_GB(stst->tcp.rcv_tcp_segs, + IOMEM_GET_FIELD64(stats, rcv_tcp_segs), old->rcv_tcp_segs); - UPDATE_STATS_GB(stst->tcp.rcv_tcp_bytes, stats->rcv_tcp_bytes, + UPDATE_STATS_GB(stst->tcp.rcv_tcp_bytes, + IOMEM_GET_FIELD64(stats, rcv_tcp_bytes), old->rcv_tcp_bytes); - UPDATE_STATS_GB(stst->iface.xmt_bytes, stats->xmit_bytes, + UPDATE_STATS_GB(stst->iface.xmt_bytes, + IOMEM_GET_FIELD64(stats, xmit_bytes), old->xmit_bytes); - UPDATE_STATS_GB(stst->iface.xmt_ucast, stats->xmit_unicasts, + UPDATE_STATS_GB(stst->iface.xmt_ucast, + IOMEM_GET_FIELD64(stats, xmit_unicasts), old->xmit_unicasts); - UPDATE_STATS_GB(stst->iface.rcv_bytes, stats->rcv_bytes, + UPDATE_STATS_GB(stst->iface.rcv_bytes, + IOMEM_GET_FIELD64(stats, rcv_bytes), old->rcv_bytes); - UPDATE_STATS_GB(stst->iface.rcv_ucast, stats->rcv_unicasts, + UPDATE_STATS_GB(stst->iface.rcv_ucast, + IOMEM_GET_FIELD64(stats, rcv_unicasts), old->rcv_unicasts); - UPDATE_STATS_GB(stst->iface.xmt_errors, stats->xmit_collisions, + UPDATE_STATS_GB(stst->iface.xmt_errors, + IOMEM_GET_FIELD64(stats, xmit_collisions), old->xmit_collisions); UPDATE_STATS_GB(stst->iface.xmt_errors, - stats->xmit_excess_collisions, + IOMEM_GET_FIELD64(stats, + xmit_excess_collisions), old->xmit_excess_collisions); - UPDATE_STATS_GB(stst->iface.xmt_errors, stats->xmit_other_error, + UPDATE_STATS_GB(stst->iface.xmt_errors, + IOMEM_GET_FIELD64(stats, xmit_other_error), old->xmit_other_error); - UPDATE_STATS_GB(stst->iface.rcv_errors, stats->rcv_other_error, + UPDATE_STATS_GB(stst->iface.rcv_errors, + IOMEM_GET_FIELD64(stats, rcv_other_error), old->rcv_other_error); -
[PATCH 0/2] staging: slicoss: fix sparse warnings
base: next-20160909, commit-id d221eb9f Peng Sun (2): staging: slicoss: slic.h: add several macros to fix sparse warnings staging: slicoss: slicoss.c: fix different address space sparse warnings drivers/staging/slicoss/slic.h| 45 + drivers/staging/slicoss/slicoss.c | 82 +++ 2 files changed, 94 insertions(+), 33 deletions(-) -- 2.7.4
[PATCH 0/2] staging: slicoss: fix sparse warnings
base: next-20160909, commit-id d221eb9f Peng Sun (2): staging: slicoss: slic.h: add several macros to fix sparse warnings staging: slicoss: slicoss.c: fix different address space sparse warnings drivers/staging/slicoss/slic.h| 45 + drivers/staging/slicoss/slicoss.c | 82 +++ 2 files changed, 94 insertions(+), 33 deletions(-) -- 2.7.4
[PATCH 0/1] staging: slicoss: slicoss: fix sparse warnings
linux-next next-20160909, commit-id d221eb9f Peng Sun (1): staging: slicoss: slicoss.c: fix different address space sparse warnings drivers/staging/slicoss/slicoss.c | 125 +++--- 1 file changed, 91 insertions(+), 34 deletions(-) -- 2.7.4
[PATCH 1/1] staging: slicoss: slicoss.c: fix different address space sparse warnings
Signed-off-by: Peng Sun <sironhide0n...@gmail.com> --- drivers/staging/slicoss/slicoss.c | 125 +++--- 1 file changed, 91 insertions(+), 34 deletions(-) diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index 21280a3..6996143 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -924,8 +924,9 @@ err_unlock_irq: static void slic_link_upr_complete(struct adapter *adapter, u32 isr) { struct slic_shmemory *sm = >shmem; - struct slic_shmem_data *sm_data = sm->shmem_data; - u32 lst = sm_data->lnkstatus; + struct slic_shmem_data __iomem *sm_data = sm->shmem_data; + u32 lst = ioread32((char __iomem *)sm_data + + offsetof(struct slic_shmem_data, lnkstatus)); uint linkup; unsigned char linkspeed; unsigned char linkduplex; @@ -1004,8 +1005,10 @@ static void slic_upr_request_complete(struct adapter *adapter, u32 isr) switch (upr->upr_request) { case SLIC_UPR_STATS: { struct slic_shmemory *sm = >shmem; - struct slic_shmem_data *sm_data = sm->shmem_data; - struct slic_stats *stats = _data->stats; + struct slic_shmem_data __iomem *sm_data = sm->shmem_data; + struct slic_stats __iomem *stats = (struct slic_stats __iomem *) + ((char __iomem *)sm_data + +offsetof(struct slic_shmem_data, stats)); struct slic_stats *old = >inicstats_prev; struct slicnet_stats *stst = >slic_stats; @@ -1015,49 +1018,91 @@ static void slic_upr_request_complete(struct adapter *adapter, u32 isr) break; } - UPDATE_STATS_GB(stst->tcp.xmit_tcp_segs, stats->xmit_tcp_segs, + UPDATE_STATS_GB(stst->tcp.xmit_tcp_segs, + readq((char __iomem *)stats + + offsetof(struct slic_stats, + xmit_tcp_segs)), old->xmit_tcp_segs); - UPDATE_STATS_GB(stst->tcp.xmit_tcp_bytes, stats->xmit_tcp_bytes, + UPDATE_STATS_GB(stst->tcp.xmit_tcp_bytes, + readq((char __iomem *)stats + + offsetof(struct slic_stats, + xmit_tcp_bytes)), old->xmit_tcp_bytes); - UPDATE_STATS_GB(stst->tcp.rcv_tcp_segs, stats->rcv_tcp_segs, + UPDATE_STATS_GB(stst->tcp.rcv_tcp_segs, + readq((char __iomem *)stats + + offsetof(struct slic_stats, + rcv_tcp_segs)), old->rcv_tcp_segs); - UPDATE_STATS_GB(stst->tcp.rcv_tcp_bytes, stats->rcv_tcp_bytes, + UPDATE_STATS_GB(stst->tcp.rcv_tcp_bytes, + readq((char __iomem *)stats + + offsetof(struct slic_stats, + rcv_tcp_bytes)), old->rcv_tcp_bytes); - UPDATE_STATS_GB(stst->iface.xmt_bytes, stats->xmit_bytes, + UPDATE_STATS_GB(stst->iface.xmt_bytes, + readq((char __iomem *)stats + + offsetof(struct slic_stats, + xmit_bytes)), old->xmit_bytes); - UPDATE_STATS_GB(stst->iface.xmt_ucast, stats->xmit_unicasts, + UPDATE_STATS_GB(stst->iface.xmt_ucast, + readq((char __iomem *)stats + + offsetof(struct slic_stats, + xmit_unicasts)), old->xmit_unicasts); - UPDATE_STATS_GB(stst->iface.rcv_bytes, stats->rcv_bytes, + UPDATE_STATS_GB(stst->iface.rcv_bytes, + readq((char __iomem *)stats + + offsetof(struct slic_stats, + rcv_bytes)), old->rcv_bytes); - UPDATE_STATS_GB(stst->iface.rcv_ucast, stats->rcv_unicasts, + UPDATE_STATS_GB(stst->iface.rcv_ucast, + readq((char __iomem *)stats + + offsetof(struct slic_stats, + rcv_unicasts)), old->rcv_unicasts); - UPDATE_STATS_GB(stst->iface.xmt_e
[PATCH 0/1] staging: slicoss: slicoss: fix sparse warnings
linux-next next-20160909, commit-id d221eb9f Peng Sun (1): staging: slicoss: slicoss.c: fix different address space sparse warnings drivers/staging/slicoss/slicoss.c | 125 +++--- 1 file changed, 91 insertions(+), 34 deletions(-) -- 2.7.4
[PATCH 1/1] staging: slicoss: slicoss.c: fix different address space sparse warnings
Signed-off-by: Peng Sun --- drivers/staging/slicoss/slicoss.c | 125 +++--- 1 file changed, 91 insertions(+), 34 deletions(-) diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index 21280a3..6996143 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -924,8 +924,9 @@ err_unlock_irq: static void slic_link_upr_complete(struct adapter *adapter, u32 isr) { struct slic_shmemory *sm = >shmem; - struct slic_shmem_data *sm_data = sm->shmem_data; - u32 lst = sm_data->lnkstatus; + struct slic_shmem_data __iomem *sm_data = sm->shmem_data; + u32 lst = ioread32((char __iomem *)sm_data + + offsetof(struct slic_shmem_data, lnkstatus)); uint linkup; unsigned char linkspeed; unsigned char linkduplex; @@ -1004,8 +1005,10 @@ static void slic_upr_request_complete(struct adapter *adapter, u32 isr) switch (upr->upr_request) { case SLIC_UPR_STATS: { struct slic_shmemory *sm = >shmem; - struct slic_shmem_data *sm_data = sm->shmem_data; - struct slic_stats *stats = _data->stats; + struct slic_shmem_data __iomem *sm_data = sm->shmem_data; + struct slic_stats __iomem *stats = (struct slic_stats __iomem *) + ((char __iomem *)sm_data + +offsetof(struct slic_shmem_data, stats)); struct slic_stats *old = >inicstats_prev; struct slicnet_stats *stst = >slic_stats; @@ -1015,49 +1018,91 @@ static void slic_upr_request_complete(struct adapter *adapter, u32 isr) break; } - UPDATE_STATS_GB(stst->tcp.xmit_tcp_segs, stats->xmit_tcp_segs, + UPDATE_STATS_GB(stst->tcp.xmit_tcp_segs, + readq((char __iomem *)stats + + offsetof(struct slic_stats, + xmit_tcp_segs)), old->xmit_tcp_segs); - UPDATE_STATS_GB(stst->tcp.xmit_tcp_bytes, stats->xmit_tcp_bytes, + UPDATE_STATS_GB(stst->tcp.xmit_tcp_bytes, + readq((char __iomem *)stats + + offsetof(struct slic_stats, + xmit_tcp_bytes)), old->xmit_tcp_bytes); - UPDATE_STATS_GB(stst->tcp.rcv_tcp_segs, stats->rcv_tcp_segs, + UPDATE_STATS_GB(stst->tcp.rcv_tcp_segs, + readq((char __iomem *)stats + + offsetof(struct slic_stats, + rcv_tcp_segs)), old->rcv_tcp_segs); - UPDATE_STATS_GB(stst->tcp.rcv_tcp_bytes, stats->rcv_tcp_bytes, + UPDATE_STATS_GB(stst->tcp.rcv_tcp_bytes, + readq((char __iomem *)stats + + offsetof(struct slic_stats, + rcv_tcp_bytes)), old->rcv_tcp_bytes); - UPDATE_STATS_GB(stst->iface.xmt_bytes, stats->xmit_bytes, + UPDATE_STATS_GB(stst->iface.xmt_bytes, + readq((char __iomem *)stats + + offsetof(struct slic_stats, + xmit_bytes)), old->xmit_bytes); - UPDATE_STATS_GB(stst->iface.xmt_ucast, stats->xmit_unicasts, + UPDATE_STATS_GB(stst->iface.xmt_ucast, + readq((char __iomem *)stats + + offsetof(struct slic_stats, + xmit_unicasts)), old->xmit_unicasts); - UPDATE_STATS_GB(stst->iface.rcv_bytes, stats->rcv_bytes, + UPDATE_STATS_GB(stst->iface.rcv_bytes, + readq((char __iomem *)stats + + offsetof(struct slic_stats, + rcv_bytes)), old->rcv_bytes); - UPDATE_STATS_GB(stst->iface.rcv_ucast, stats->rcv_unicasts, + UPDATE_STATS_GB(stst->iface.rcv_ucast, + readq((char __iomem *)stats + + offsetof(struct slic_stats, + rcv_unicasts)), old->rcv_unicasts); - UPDATE_STATS_GB(stst->iface.xmt_errors, stats-&
[PATCH 2/3] staging: android: ashmem.c: 'No space necessary after' style issue
fix two CHECK issues by checkpatch.pl with --strict: No space is necessary after a cast Signed-off-by: Peng Sun --- drivers/staging/android/ashmem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c index b340ddc..1312600 100644 --- a/drivers/staging/android/ashmem.c +++ b/drivers/staging/android/ashmem.c @@ -716,7 +716,7 @@ static int ashmem_pin_unpin(struct ashmem_area *asma, unsigned long cmd, if (unlikely((pin.offset | pin.len) & ~PAGE_MASK)) return -EINVAL; - if (unlikely(((__u32) -1) - pin.offset < pin.len)) + if (unlikely(((__u32)-1) - pin.offset < pin.len)) return -EINVAL; if (unlikely(PAGE_ALIGN(asma->size) < pin.offset + pin.len)) @@ -760,7 +760,7 @@ static long ashmem_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ret = -EINVAL; if (!asma->file) { ret = 0; - asma->size = (size_t) arg; + asma->size = (size_t)arg; } break; case ASHMEM_GET_SIZE: -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/3] staging: android: ashmem.c: 'Alignment' style issue
fix two CHECK issues by checkpatch.pl with --strict: Alignment should match open parenthesis Signed-off-by: Peng Sun --- drivers/staging/android/ashmem.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c index 1312600..d786ec1 100644 --- a/drivers/staging/android/ashmem.c +++ b/drivers/staging/android/ashmem.c @@ -834,16 +834,16 @@ static int __init ashmem_init(void) int ret; ashmem_area_cachep = kmem_cache_create("ashmem_area_cache", - sizeof(struct ashmem_area), - 0, 0, NULL); + sizeof(struct ashmem_area), + 0, 0, NULL); if (unlikely(!ashmem_area_cachep)) { pr_err("failed to create slab cache\n"); return -ENOMEM; } ashmem_range_cachep = kmem_cache_create("ashmem_range_cache", - sizeof(struct ashmem_range), - 0, 0, NULL); + sizeof(struct ashmem_range), + 0, 0, NULL); if (unlikely(!ashmem_range_cachep)) { pr_err("failed to create slab cache\n"); return -ENOMEM; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 0/3] staging: android: ashmem.c: fix several coding style issues
patches based on linux-next next-20150826 Corrections based on checkpatch.pl with --strict Peng Sun (3): staging: android: ashmem.c: 'spaces preferred around that -' style issue staging: android: ashmem.c: 'No space necessary after' style issue staging: android: ashmem.c: 'Alignment' style issue drivers/staging/android/ashmem.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/3] staging: android: ashmem.c: 'spaces preferred around that -' style issue
fix a CHECK style issue by checkpatch.pl with --strict: spaces preferred around that '-' Signed-off-by: Peng Sun --- drivers/staging/android/ashmem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c index 60200a3..b340ddc 100644 --- a/drivers/staging/android/ashmem.c +++ b/drivers/staging/android/ashmem.c @@ -618,7 +618,8 @@ static int ashmem_pin(struct ashmem_area *asma, size_t pgstart, size_t pgend) /* Case #3: We overlap from the rear, so adjust it */ if (range->pgend <= pgend) { - range_shrink(range, range->pgstart, pgstart-1); + range_shrink(range, range->pgstart, +pgstart - 1); continue; } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/3] staging: android: ashmem.c: 'spaces preferred around that -' style issue
fix a CHECK style issue by checkpatch.pl with --strict: spaces preferred around that '-' Signed-off-by: Peng Sun sironhide0n...@gmail.com --- drivers/staging/android/ashmem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c index 60200a3..b340ddc 100644 --- a/drivers/staging/android/ashmem.c +++ b/drivers/staging/android/ashmem.c @@ -618,7 +618,8 @@ static int ashmem_pin(struct ashmem_area *asma, size_t pgstart, size_t pgend) /* Case #3: We overlap from the rear, so adjust it */ if (range-pgend = pgend) { - range_shrink(range, range-pgstart, pgstart-1); + range_shrink(range, range-pgstart, +pgstart - 1); continue; } -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 0/3] staging: android: ashmem.c: fix several coding style issues
patches based on linux-next next-20150826 Corrections based on checkpatch.pl with --strict Peng Sun (3): staging: android: ashmem.c: 'spaces preferred around that -' style issue staging: android: ashmem.c: 'No space necessary after' style issue staging: android: ashmem.c: 'Alignment' style issue drivers/staging/android/ashmem.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/3] staging: android: ashmem.c: 'No space necessary after' style issue
fix two CHECK issues by checkpatch.pl with --strict: No space is necessary after a cast Signed-off-by: Peng Sun sironhide0n...@gmail.com --- drivers/staging/android/ashmem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c index b340ddc..1312600 100644 --- a/drivers/staging/android/ashmem.c +++ b/drivers/staging/android/ashmem.c @@ -716,7 +716,7 @@ static int ashmem_pin_unpin(struct ashmem_area *asma, unsigned long cmd, if (unlikely((pin.offset | pin.len) ~PAGE_MASK)) return -EINVAL; - if (unlikely(((__u32) -1) - pin.offset pin.len)) + if (unlikely(((__u32)-1) - pin.offset pin.len)) return -EINVAL; if (unlikely(PAGE_ALIGN(asma-size) pin.offset + pin.len)) @@ -760,7 +760,7 @@ static long ashmem_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ret = -EINVAL; if (!asma-file) { ret = 0; - asma-size = (size_t) arg; + asma-size = (size_t)arg; } break; case ASHMEM_GET_SIZE: -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/3] staging: android: ashmem.c: 'Alignment' style issue
fix two CHECK issues by checkpatch.pl with --strict: Alignment should match open parenthesis Signed-off-by: Peng Sun sironhide0n...@gmail.com --- drivers/staging/android/ashmem.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c index 1312600..d786ec1 100644 --- a/drivers/staging/android/ashmem.c +++ b/drivers/staging/android/ashmem.c @@ -834,16 +834,16 @@ static int __init ashmem_init(void) int ret; ashmem_area_cachep = kmem_cache_create(ashmem_area_cache, - sizeof(struct ashmem_area), - 0, 0, NULL); + sizeof(struct ashmem_area), + 0, 0, NULL); if (unlikely(!ashmem_area_cachep)) { pr_err(failed to create slab cache\n); return -ENOMEM; } ashmem_range_cachep = kmem_cache_create(ashmem_range_cache, - sizeof(struct ashmem_range), - 0, 0, NULL); + sizeof(struct ashmem_range), + 0, 0, NULL); if (unlikely(!ashmem_range_cachep)) { pr_err(failed to create slab cache\n); return -ENOMEM; -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 6/8] fix staging:android style issue:Comparison to NULL could be written
Signed-off-by: Peng Sun --- drivers/staging/android/sw_sync.c | 6 +++--- drivers/staging/android/sync.c| 18 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/staging/android/sw_sync.c b/drivers/staging/android/sw_sync.c index c90838d..29b5c35 100644 --- a/drivers/staging/android/sw_sync.c +++ b/drivers/staging/android/sw_sync.c @@ -145,7 +145,7 @@ static int sw_sync_open(struct inode *inode, struct file *file) get_task_comm(task_comm, current); obj = sw_sync_timeline_create(task_comm); - if (obj == NULL) + if (!obj) return -ENOMEM; file->private_data = obj; @@ -179,14 +179,14 @@ static long sw_sync_ioctl_create_fence(struct sw_sync_timeline *obj, } pt = sw_sync_pt_create(obj, data.value); - if (pt == NULL) { + if (!pt) { err = -ENOMEM; goto err; } data.name[sizeof(data.name) - 1] = '\0'; fence = sync_fence_create(data.name, pt); - if (fence == NULL) { + if (!fence) { sync_pt_free(pt); err = -ENOMEM; goto err; diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c index 9a67d23..e0c1acb 100644 --- a/drivers/staging/android/sync.c +++ b/drivers/staging/android/sync.c @@ -43,7 +43,7 @@ struct sync_timeline *sync_timeline_create(const struct sync_timeline_ops *ops, return NULL; obj = kzalloc(size, GFP_KERNEL); - if (obj == NULL) + if (!obj) return NULL; kref_init(>kref); @@ -130,7 +130,7 @@ struct sync_pt *sync_pt_create(struct sync_timeline *obj, int size) return NULL; pt = kzalloc(size, GFP_KERNEL); - if (pt == NULL) + if (!pt) return NULL; spin_lock_irqsave(>child_list_lock, flags); @@ -155,7 +155,7 @@ static struct sync_fence *sync_fence_alloc(int size, const char *name) struct sync_fence *fence; fence = kzalloc(size, GFP_KERNEL); - if (fence == NULL) + if (!fence) return NULL; fence->file = anon_inode_getfile("sync_fence", _fence_fops, @@ -193,7 +193,7 @@ struct sync_fence *sync_fence_create(const char *name, struct sync_pt *pt) struct sync_fence *fence; fence = sync_fence_alloc(offsetof(struct sync_fence, cbs[1]), name); - if (fence == NULL) + if (!fence) return NULL; fence->num_fences = 1; @@ -215,7 +215,7 @@ struct sync_fence *sync_fence_fdget(int fd) { struct file *file = fget(fd); - if (file == NULL) + if (!file) return NULL; if (file->f_op != _fence_fops) @@ -262,7 +262,7 @@ struct sync_fence *sync_fence_merge(const char *name, unsigned long size = offsetof(struct sync_fence, cbs[num_fences]); fence = sync_fence_alloc(size, name); - if (fence == NULL) + if (!fence) return NULL; atomic_set(>status, num_fences); @@ -583,14 +583,14 @@ static long sync_fence_ioctl_merge(struct sync_fence *fence, unsigned long arg) } fence2 = sync_fence_fdget(data.fd2); - if (fence2 == NULL) { + if (!fence2) { err = -ENOENT; goto err_put_fd; } data.name[sizeof(data.name) - 1] = '\0'; fence3 = sync_fence_merge(data.name, fence, fence2); - if (fence3 == NULL) { + if (!fence3) { err = -ENOMEM; goto err_put_fence2; } @@ -666,7 +666,7 @@ static long sync_fence_ioctl_fence_info(struct sync_fence *fence, size = 4096; data = kzalloc(size, GFP_KERNEL); - if (data == NULL) + if (!data) return -ENOMEM; strlcpy(data->name, fence->name, sizeof(data->name)); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/8] fix staging:android style issue:Alignment should match open parenthesis
Signed-off-by: Peng Sun --- drivers/staging/android/ashmem.c | 8 drivers/staging/android/lowmemorykiller.c | 4 ++-- drivers/staging/android/sync.c| 4 ++-- drivers/staging/android/sync.h| 2 +- drivers/staging/android/timed_gpio.c | 12 +++- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c index 1312600..d786ec1 100644 --- a/drivers/staging/android/ashmem.c +++ b/drivers/staging/android/ashmem.c @@ -834,16 +834,16 @@ static int __init ashmem_init(void) int ret; ashmem_area_cachep = kmem_cache_create("ashmem_area_cache", - sizeof(struct ashmem_area), - 0, 0, NULL); + sizeof(struct ashmem_area), + 0, 0, NULL); if (unlikely(!ashmem_area_cachep)) { pr_err("failed to create slab cache\n"); return -ENOMEM; } ashmem_range_cachep = kmem_cache_create("ashmem_range_cache", - sizeof(struct ashmem_range), - 0, 0, NULL); + sizeof(struct ashmem_range), + 0, 0, NULL); if (unlikely(!ashmem_range_cachep)) { pr_err("failed to create slab cache\n"); return -ENOMEM; diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c index 872bd60..61937ab 100644 --- a/drivers/staging/android/lowmemorykiller.c +++ b/drivers/staging/android/lowmemorykiller.c @@ -104,8 +104,8 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc) } lowmem_print(3, "lowmem_scan %lu, %x, ofree %d %d, ma %hd\n", - sc->nr_to_scan, sc->gfp_mask, other_free, - other_file, min_score_adj); +sc->nr_to_scan, sc->gfp_mask, other_free, +other_file, min_score_adj); if (min_score_adj == OOM_SCORE_ADJ_MAX + 1) { lowmem_print(5, "lowmem_scan %lu, %x, return 0\n", diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c index f83e00c..9a67d23 100644 --- a/drivers/staging/android/sync.c +++ b/drivers/staging/android/sync.c @@ -313,7 +313,7 @@ struct sync_fence *sync_fence_merge(const char *name, EXPORT_SYMBOL(sync_fence_merge); int sync_fence_wake_up_wq(wait_queue_t *curr, unsigned mode, -int wake_flags, void *key) + int wake_flags, void *key) { struct sync_fence_waiter *wait; @@ -353,7 +353,7 @@ int sync_fence_wait_async(struct sync_fence *fence, EXPORT_SYMBOL(sync_fence_wait_async); int sync_fence_cancel_async(struct sync_fence *fence, -struct sync_fence_waiter *waiter) + struct sync_fence_waiter *waiter) { unsigned long flags; int ret = 0; diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h index 61f8a3a..18a94ed 100644 --- a/drivers/staging/android/sync.h +++ b/drivers/staging/android/sync.h @@ -351,6 +351,6 @@ void sync_dump(void); # define sync_dump() #endif int sync_fence_wake_up_wq(wait_queue_t *curr, unsigned mode, -int wake_flags, void *key); + int wake_flags, void *key); #endif /* _LINUX_SYNC_H */ diff --git a/drivers/staging/android/timed_gpio.c b/drivers/staging/android/timed_gpio.c index ce11726..5407257 100644 --- a/drivers/staging/android/timed_gpio.c +++ b/drivers/staging/android/timed_gpio.c @@ -76,8 +76,9 @@ static void gpio_enable(struct timed_output_dev *dev, int value) value = data->max_timeout; hrtimer_start(>timer, - ktime_set(value / 1000, (value % 1000) * 100), - HRTIMER_MODE_REL); + ktime_set(value / 1000, (value % 1000) * + 100), + HRTIMER_MODE_REL); } spin_unlock_irqrestore(>lock, flags); @@ -94,8 +95,9 @@ static int timed_gpio_probe(struct platform_device *pdev) return -EBUSY; gpio_data = devm_kzalloc(>dev, - sizeof(struct timed_gpio_data) * pdata->num_gpios, - GFP_KERNEL); +sizeof(struct timed_gpio_data) * +pdata->num_gpios, +GFP_KERNEL); if (!gpio_data) return -ENOMEM; @@ -104,7 +106,7 @@ static int timed_gpio_probe(struct
[PATCH 2/8] fix staging:android style issue:No space is necessary after a cast
Signed-off-by: Peng Sun --- drivers/staging/android/ashmem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c index b340ddc..1312600 100644 --- a/drivers/staging/android/ashmem.c +++ b/drivers/staging/android/ashmem.c @@ -716,7 +716,7 @@ static int ashmem_pin_unpin(struct ashmem_area *asma, unsigned long cmd, if (unlikely((pin.offset | pin.len) & ~PAGE_MASK)) return -EINVAL; - if (unlikely(((__u32) -1) - pin.offset < pin.len)) + if (unlikely(((__u32)-1) - pin.offset < pin.len)) return -EINVAL; if (unlikely(PAGE_ALIGN(asma->size) < pin.offset + pin.len)) @@ -760,7 +760,7 @@ static long ashmem_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ret = -EINVAL; if (!asma->file) { ret = 0; - asma->size = (size_t) arg; + asma->size = (size_t)arg; } break; case ASHMEM_GET_SIZE: -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 4/8] fix staging:android style issue:Prefer kernel type 'u32' over 'uint32_t'
Signed-off-by: Peng Sun --- drivers/staging/android/lowmemorykiller.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c index 61937ab..78e1281 100644 --- a/drivers/staging/android/lowmemorykiller.c +++ b/drivers/staging/android/lowmemorykiller.c @@ -42,7 +42,7 @@ #include #include -static uint32_t lowmem_debug_level = 1; +static u32 lowmem_debug_level = 1; static short lowmem_adj[6] = { 0, 1, -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 7/8] fix staging:android style issue:definition without comment
Signed-off-by: Peng Sun --- drivers/staging/android/sync.h | 2 +- drivers/staging/android/timed_gpio.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h index 18a94ed..bb42923 100644 --- a/drivers/staging/android/sync.h +++ b/drivers/staging/android/sync.h @@ -94,11 +94,11 @@ struct sync_timeline { const struct sync_timeline_ops *ops; charname[32]; - /* protected by child_list_lock */ booldestroyed; int context, value; struct list_headchild_list_head; + /* protect field destroyed */ spinlock_t child_list_lock; struct list_headactive_list_head; diff --git a/drivers/staging/android/timed_gpio.c b/drivers/staging/android/timed_gpio.c index 5407257..5c55463 100644 --- a/drivers/staging/android/timed_gpio.c +++ b/drivers/staging/android/timed_gpio.c @@ -29,7 +29,7 @@ struct timed_gpio_data { struct timed_output_dev dev; struct hrtimer timer; - spinlock_t lock; + spinlock_t lock; /* protect structure fields */ unsigned gpio; int max_timeout; u8 active_low; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 8/8] fix staging:android style issue:Please don't use multiple blank lines
Signed-off-by: Peng Sun --- drivers/staging/android/timed_gpio.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/android/timed_gpio.c b/drivers/staging/android/timed_gpio.c index 5c55463..33acbbe 100644 --- a/drivers/staging/android/timed_gpio.c +++ b/drivers/staging/android/timed_gpio.c @@ -25,7 +25,6 @@ #include "timed_output.h" #include "timed_gpio.h" - struct timed_gpio_data { struct timed_output_dev dev; struct hrtimer timer; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 5/8] fix staging:android style issue:Please use a blank line after function/struct/union/enum declarations
Signed-off-by: Peng Sun --- drivers/staging/android/lowmemorykiller.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c index 78e1281..3f1311f 100644 --- a/drivers/staging/android/lowmemorykiller.c +++ b/drivers/staging/android/lowmemorykiller.c @@ -49,6 +49,7 @@ static short lowmem_adj[6] = { 6, 12, }; + static int lowmem_adj_size = 4; static int lowmem_minfree[6] = { 3 * 512,/* 6MB */ @@ -56,8 +57,8 @@ static int lowmem_minfree[6] = { 4 * 1024, /* 16MB */ 16 * 1024, /* 64MB */ }; -static int lowmem_minfree_size = 4; +static int lowmem_minfree_size = 4; static unsigned long lowmem_deathpending_timeout; #define lowmem_print(level, x...) \ -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/8] fix staging:android style issue:spaces preferred around that '-'
Signed-off-by: Peng Sun --- drivers/staging/android/ashmem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c index 60200a3..b340ddc 100644 --- a/drivers/staging/android/ashmem.c +++ b/drivers/staging/android/ashmem.c @@ -618,7 +618,8 @@ static int ashmem_pin(struct ashmem_area *asma, size_t pgstart, size_t pgend) /* Case #3: We overlap from the rear, so adjust it */ if (range->pgend <= pgend) { - range_shrink(range, range->pgstart, pgstart-1); + range_shrink(range, range->pgstart, +pgstart - 1); continue; } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 0/8] fix drivers/staging/android several coding style issues
patches based on linux-next next-20150825 Corrections based on checkpatch.pl with --strict Peng Sun (8): fix staging:android style issue:spaces preferred around that '-' fix staging:android style issue:No space is necessary after a cast fix staging:android style issue:Alignment should match open parenthesis fix staging:android style issue:Prefer kernel type 'u32' over 'uint32_t' fix staging:android style issue:Please use a blank line after function/struct/union/enum declarations fix staging:android style issue:Comparison to NULL could be written fix staging:android style issue:definition without comment fix staging:android style issue:Please don't use multiple blank lines drivers/staging/android/ashmem.c | 15 --- drivers/staging/android/lowmemorykiller.c | 9 + drivers/staging/android/sw_sync.c | 6 +++--- drivers/staging/android/sync.c| 22 +++--- drivers/staging/android/sync.h| 4 ++-- drivers/staging/android/timed_gpio.c | 15 --- 6 files changed, 37 insertions(+), 34 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 6/6] fix android/timed_gpio.c several coding style issues
Corrections based on checkpatch.pl with --strict 1) Please don't use multiple blank lines 2) spinlock_t definition without comment 3) Alignment should match open parenthesis Signed-off-by: Peng Sun --- drivers/staging/android/timed_gpio.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/staging/android/timed_gpio.c b/drivers/staging/android/timed_gpio.c index ce11726..33acbbe 100644 --- a/drivers/staging/android/timed_gpio.c +++ b/drivers/staging/android/timed_gpio.c @@ -25,11 +25,10 @@ #include "timed_output.h" #include "timed_gpio.h" - struct timed_gpio_data { struct timed_output_dev dev; struct hrtimer timer; - spinlock_t lock; + spinlock_t lock; /* protect structure fields */ unsigned gpio; int max_timeout; u8 active_low; @@ -76,8 +75,9 @@ static void gpio_enable(struct timed_output_dev *dev, int value) value = data->max_timeout; hrtimer_start(>timer, - ktime_set(value / 1000, (value % 1000) * 100), - HRTIMER_MODE_REL); + ktime_set(value / 1000, (value % 1000) * + 100), + HRTIMER_MODE_REL); } spin_unlock_irqrestore(>lock, flags); @@ -94,8 +94,9 @@ static int timed_gpio_probe(struct platform_device *pdev) return -EBUSY; gpio_data = devm_kzalloc(>dev, - sizeof(struct timed_gpio_data) * pdata->num_gpios, - GFP_KERNEL); +sizeof(struct timed_gpio_data) * +pdata->num_gpios, +GFP_KERNEL); if (!gpio_data) return -ENOMEM; @@ -104,7 +105,7 @@ static int timed_gpio_probe(struct platform_device *pdev) gpio_dat = _data[i]; hrtimer_init(_dat->timer, CLOCK_MONOTONIC, - HRTIMER_MODE_REL); +HRTIMER_MODE_REL); gpio_dat->timer.function = gpio_timer_func; spin_lock_init(_dat->lock); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/6] fix android/sw_sync.c several coding style issues
Corrections based on checkpatch.pl with --strict 1) Comparison to NULL could be written "!obj" 2) Comparison to NULL could be written "!pt" 3) Comparison to NULL could be written "!fence" Signed-off-by: Peng Sun --- drivers/staging/android/sw_sync.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/android/sw_sync.c b/drivers/staging/android/sw_sync.c index c90838d..29b5c35 100644 --- a/drivers/staging/android/sw_sync.c +++ b/drivers/staging/android/sw_sync.c @@ -145,7 +145,7 @@ static int sw_sync_open(struct inode *inode, struct file *file) get_task_comm(task_comm, current); obj = sw_sync_timeline_create(task_comm); - if (obj == NULL) + if (!obj) return -ENOMEM; file->private_data = obj; @@ -179,14 +179,14 @@ static long sw_sync_ioctl_create_fence(struct sw_sync_timeline *obj, } pt = sw_sync_pt_create(obj, data.value); - if (pt == NULL) { + if (!pt) { err = -ENOMEM; goto err; } data.name[sizeof(data.name) - 1] = '\0'; fence = sync_fence_create(data.name, pt); - if (fence == NULL) { + if (!fence) { sync_pt_free(pt); err = -ENOMEM; goto err; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 4/6] fix android/sync.c several coding style issues
Corrections based on checkpatch.pl with --strict 1) Comparison to NULL could be written "!*" 2) Alignment should match open parenthesis Signed-off-by: Peng Sun --- drivers/staging/android/sync.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c index f83e00c..e0c1acb 100644 --- a/drivers/staging/android/sync.c +++ b/drivers/staging/android/sync.c @@ -43,7 +43,7 @@ struct sync_timeline *sync_timeline_create(const struct sync_timeline_ops *ops, return NULL; obj = kzalloc(size, GFP_KERNEL); - if (obj == NULL) + if (!obj) return NULL; kref_init(>kref); @@ -130,7 +130,7 @@ struct sync_pt *sync_pt_create(struct sync_timeline *obj, int size) return NULL; pt = kzalloc(size, GFP_KERNEL); - if (pt == NULL) + if (!pt) return NULL; spin_lock_irqsave(>child_list_lock, flags); @@ -155,7 +155,7 @@ static struct sync_fence *sync_fence_alloc(int size, const char *name) struct sync_fence *fence; fence = kzalloc(size, GFP_KERNEL); - if (fence == NULL) + if (!fence) return NULL; fence->file = anon_inode_getfile("sync_fence", _fence_fops, @@ -193,7 +193,7 @@ struct sync_fence *sync_fence_create(const char *name, struct sync_pt *pt) struct sync_fence *fence; fence = sync_fence_alloc(offsetof(struct sync_fence, cbs[1]), name); - if (fence == NULL) + if (!fence) return NULL; fence->num_fences = 1; @@ -215,7 +215,7 @@ struct sync_fence *sync_fence_fdget(int fd) { struct file *file = fget(fd); - if (file == NULL) + if (!file) return NULL; if (file->f_op != _fence_fops) @@ -262,7 +262,7 @@ struct sync_fence *sync_fence_merge(const char *name, unsigned long size = offsetof(struct sync_fence, cbs[num_fences]); fence = sync_fence_alloc(size, name); - if (fence == NULL) + if (!fence) return NULL; atomic_set(>status, num_fences); @@ -313,7 +313,7 @@ struct sync_fence *sync_fence_merge(const char *name, EXPORT_SYMBOL(sync_fence_merge); int sync_fence_wake_up_wq(wait_queue_t *curr, unsigned mode, -int wake_flags, void *key) + int wake_flags, void *key) { struct sync_fence_waiter *wait; @@ -353,7 +353,7 @@ int sync_fence_wait_async(struct sync_fence *fence, EXPORT_SYMBOL(sync_fence_wait_async); int sync_fence_cancel_async(struct sync_fence *fence, -struct sync_fence_waiter *waiter) + struct sync_fence_waiter *waiter) { unsigned long flags; int ret = 0; @@ -583,14 +583,14 @@ static long sync_fence_ioctl_merge(struct sync_fence *fence, unsigned long arg) } fence2 = sync_fence_fdget(data.fd2); - if (fence2 == NULL) { + if (!fence2) { err = -ENOENT; goto err_put_fd; } data.name[sizeof(data.name) - 1] = '\0'; fence3 = sync_fence_merge(data.name, fence, fence2); - if (fence3 == NULL) { + if (!fence3) { err = -ENOMEM; goto err_put_fence2; } @@ -666,7 +666,7 @@ static long sync_fence_ioctl_fence_info(struct sync_fence *fence, size = 4096; data = kzalloc(size, GFP_KERNEL); - if (data == NULL) + if (!data) return -ENOMEM; strlcpy(data->name, fence->name, sizeof(data->name)); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 5/6] fix android/sync.h several coding style issues
Corrections based on checkpatch.pl with --strict 1) spinlock_t definition without comment 2) Alignment should match open parenthesis Signed-off-by: Peng Sun --- drivers/staging/android/sync.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h index 61f8a3a..87358d2 100644 --- a/drivers/staging/android/sync.h +++ b/drivers/staging/android/sync.h @@ -94,12 +94,11 @@ struct sync_timeline { const struct sync_timeline_ops *ops; charname[32]; - /* protected by child_list_lock */ booldestroyed; int context, value; struct list_headchild_list_head; - spinlock_t child_list_lock; + spinlock_t child_list_lock; /* protect destroyed */ struct list_headactive_list_head; @@ -351,6 +350,6 @@ void sync_dump(void); # define sync_dump() #endif int sync_fence_wake_up_wq(wait_queue_t *curr, unsigned mode, -int wake_flags, void *key); + int wake_flags, void *key); #endif /* _LINUX_SYNC_H */ -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/6] fix android/ashmem.c several coding style issues
Corrections based on checkpatch.pl with --strict 1) spaces preferred around that '-' 2) No space is necessary after a case 3) Alignment should match open parenthesis Signed-off-by: Peng Sun --- drivers/staging/android/ashmem.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c index 60200a3..d786ec1 100644 --- a/drivers/staging/android/ashmem.c +++ b/drivers/staging/android/ashmem.c @@ -618,7 +618,8 @@ static int ashmem_pin(struct ashmem_area *asma, size_t pgstart, size_t pgend) /* Case #3: We overlap from the rear, so adjust it */ if (range->pgend <= pgend) { - range_shrink(range, range->pgstart, pgstart-1); + range_shrink(range, range->pgstart, +pgstart - 1); continue; } @@ -715,7 +716,7 @@ static int ashmem_pin_unpin(struct ashmem_area *asma, unsigned long cmd, if (unlikely((pin.offset | pin.len) & ~PAGE_MASK)) return -EINVAL; - if (unlikely(((__u32) -1) - pin.offset < pin.len)) + if (unlikely(((__u32)-1) - pin.offset < pin.len)) return -EINVAL; if (unlikely(PAGE_ALIGN(asma->size) < pin.offset + pin.len)) @@ -759,7 +760,7 @@ static long ashmem_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ret = -EINVAL; if (!asma->file) { ret = 0; - asma->size = (size_t) arg; + asma->size = (size_t)arg; } break; case ASHMEM_GET_SIZE: @@ -833,16 +834,16 @@ static int __init ashmem_init(void) int ret; ashmem_area_cachep = kmem_cache_create("ashmem_area_cache", - sizeof(struct ashmem_area), - 0, 0, NULL); + sizeof(struct ashmem_area), + 0, 0, NULL); if (unlikely(!ashmem_area_cachep)) { pr_err("failed to create slab cache\n"); return -ENOMEM; } ashmem_range_cachep = kmem_cache_create("ashmem_range_cache", - sizeof(struct ashmem_range), - 0, 0, NULL); + sizeof(struct ashmem_range), + 0, 0, NULL); if (unlikely(!ashmem_range_cachep)) { pr_err("failed to create slab cache\n"); return -ENOMEM; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 0/6] fix drivers/staging/android several coding issues
patches based on linux-next next-20150824 Corrections based on checkpatch.pl with --strict Peng Sun (6): fix android/ashmem.c several coding style issues fix android/lowmemorykiller.c several coding style issues fix android/sw_sync.c several coding style issues fix android/sync.c several coding style issues fix android/sync.h several coding style issues fix android/timed_gpio.c several coding style issues drivers/staging/android/ashmem.c | 15 --- drivers/staging/android/lowmemorykiller.c | 8 +--- drivers/staging/android/sw_sync.c | 6 +++--- drivers/staging/android/sync.c| 22 +++--- drivers/staging/android/sync.h| 5 ++--- drivers/staging/android/timed_gpio.c | 15 --- 6 files changed, 37 insertions(+), 34 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/6] fix android/lowmemorykiller.c several coding style issues
Corrections based on checkpatch.pl with --strict 1) Prefer kernel type 'u32' over 'uint32_t' 2) Please use a blank line after function/struct/union/enum declarations 3) Alignment should match open parenthesis Signed-off-by: Peng Sun --- drivers/staging/android/lowmemorykiller.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c index 872bd60..2315e41 100644 --- a/drivers/staging/android/lowmemorykiller.c +++ b/drivers/staging/android/lowmemorykiller.c @@ -42,13 +42,14 @@ #include #include -static uint32_t lowmem_debug_level = 1; +static u32 lowmem_debug_level = 1; static short lowmem_adj[6] = { 0, 1, 6, 12, }; + static int lowmem_adj_size = 4; static int lowmem_minfree[6] = { 3 * 512,/* 6MB */ @@ -56,6 +57,7 @@ static int lowmem_minfree[6] = { 4 * 1024, /* 16MB */ 16 * 1024, /* 64MB */ }; + static int lowmem_minfree_size = 4; static unsigned long lowmem_deathpending_timeout; @@ -104,8 +106,8 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc) } lowmem_print(3, "lowmem_scan %lu, %x, ofree %d %d, ma %hd\n", - sc->nr_to_scan, sc->gfp_mask, other_free, - other_file, min_score_adj); +sc->nr_to_scan, sc->gfp_mask, other_free, +other_file, min_score_adj); if (min_score_adj == OOM_SCORE_ADJ_MAX + 1) { lowmem_print(5, "lowmem_scan %lu, %x, return 0\n", -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 0/8] fix drivers/staging/android several coding style issues
patches based on linux-next next-20150825 Corrections based on checkpatch.pl with --strict Peng Sun (8): fix staging:android style issue:spaces preferred around that '-' fix staging:android style issue:No space is necessary after a cast fix staging:android style issue:Alignment should match open parenthesis fix staging:android style issue:Prefer kernel type 'u32' over 'uint32_t' fix staging:android style issue:Please use a blank line after function/struct/union/enum declarations fix staging:android style issue:Comparison to NULL could be written fix staging:android style issue:definition without comment fix staging:android style issue:Please don't use multiple blank lines drivers/staging/android/ashmem.c | 15 --- drivers/staging/android/lowmemorykiller.c | 9 + drivers/staging/android/sw_sync.c | 6 +++--- drivers/staging/android/sync.c| 22 +++--- drivers/staging/android/sync.h| 4 ++-- drivers/staging/android/timed_gpio.c | 15 --- 6 files changed, 37 insertions(+), 34 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/8] fix staging:android style issue:spaces preferred around that '-'
Signed-off-by: Peng Sun sironhide0n...@gmail.com --- drivers/staging/android/ashmem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c index 60200a3..b340ddc 100644 --- a/drivers/staging/android/ashmem.c +++ b/drivers/staging/android/ashmem.c @@ -618,7 +618,8 @@ static int ashmem_pin(struct ashmem_area *asma, size_t pgstart, size_t pgend) /* Case #3: We overlap from the rear, so adjust it */ if (range-pgend = pgend) { - range_shrink(range, range-pgstart, pgstart-1); + range_shrink(range, range-pgstart, +pgstart - 1); continue; } -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 6/8] fix staging:android style issue:Comparison to NULL could be written
Signed-off-by: Peng Sun sironhide0n...@gmail.com --- drivers/staging/android/sw_sync.c | 6 +++--- drivers/staging/android/sync.c| 18 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/staging/android/sw_sync.c b/drivers/staging/android/sw_sync.c index c90838d..29b5c35 100644 --- a/drivers/staging/android/sw_sync.c +++ b/drivers/staging/android/sw_sync.c @@ -145,7 +145,7 @@ static int sw_sync_open(struct inode *inode, struct file *file) get_task_comm(task_comm, current); obj = sw_sync_timeline_create(task_comm); - if (obj == NULL) + if (!obj) return -ENOMEM; file-private_data = obj; @@ -179,14 +179,14 @@ static long sw_sync_ioctl_create_fence(struct sw_sync_timeline *obj, } pt = sw_sync_pt_create(obj, data.value); - if (pt == NULL) { + if (!pt) { err = -ENOMEM; goto err; } data.name[sizeof(data.name) - 1] = '\0'; fence = sync_fence_create(data.name, pt); - if (fence == NULL) { + if (!fence) { sync_pt_free(pt); err = -ENOMEM; goto err; diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c index 9a67d23..e0c1acb 100644 --- a/drivers/staging/android/sync.c +++ b/drivers/staging/android/sync.c @@ -43,7 +43,7 @@ struct sync_timeline *sync_timeline_create(const struct sync_timeline_ops *ops, return NULL; obj = kzalloc(size, GFP_KERNEL); - if (obj == NULL) + if (!obj) return NULL; kref_init(obj-kref); @@ -130,7 +130,7 @@ struct sync_pt *sync_pt_create(struct sync_timeline *obj, int size) return NULL; pt = kzalloc(size, GFP_KERNEL); - if (pt == NULL) + if (!pt) return NULL; spin_lock_irqsave(obj-child_list_lock, flags); @@ -155,7 +155,7 @@ static struct sync_fence *sync_fence_alloc(int size, const char *name) struct sync_fence *fence; fence = kzalloc(size, GFP_KERNEL); - if (fence == NULL) + if (!fence) return NULL; fence-file = anon_inode_getfile(sync_fence, sync_fence_fops, @@ -193,7 +193,7 @@ struct sync_fence *sync_fence_create(const char *name, struct sync_pt *pt) struct sync_fence *fence; fence = sync_fence_alloc(offsetof(struct sync_fence, cbs[1]), name); - if (fence == NULL) + if (!fence) return NULL; fence-num_fences = 1; @@ -215,7 +215,7 @@ struct sync_fence *sync_fence_fdget(int fd) { struct file *file = fget(fd); - if (file == NULL) + if (!file) return NULL; if (file-f_op != sync_fence_fops) @@ -262,7 +262,7 @@ struct sync_fence *sync_fence_merge(const char *name, unsigned long size = offsetof(struct sync_fence, cbs[num_fences]); fence = sync_fence_alloc(size, name); - if (fence == NULL) + if (!fence) return NULL; atomic_set(fence-status, num_fences); @@ -583,14 +583,14 @@ static long sync_fence_ioctl_merge(struct sync_fence *fence, unsigned long arg) } fence2 = sync_fence_fdget(data.fd2); - if (fence2 == NULL) { + if (!fence2) { err = -ENOENT; goto err_put_fd; } data.name[sizeof(data.name) - 1] = '\0'; fence3 = sync_fence_merge(data.name, fence, fence2); - if (fence3 == NULL) { + if (!fence3) { err = -ENOMEM; goto err_put_fence2; } @@ -666,7 +666,7 @@ static long sync_fence_ioctl_fence_info(struct sync_fence *fence, size = 4096; data = kzalloc(size, GFP_KERNEL); - if (data == NULL) + if (!data) return -ENOMEM; strlcpy(data-name, fence-name, sizeof(data-name)); -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/8] fix staging:android style issue:Alignment should match open parenthesis
Signed-off-by: Peng Sun sironhide0n...@gmail.com --- drivers/staging/android/ashmem.c | 8 drivers/staging/android/lowmemorykiller.c | 4 ++-- drivers/staging/android/sync.c| 4 ++-- drivers/staging/android/sync.h| 2 +- drivers/staging/android/timed_gpio.c | 12 +++- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c index 1312600..d786ec1 100644 --- a/drivers/staging/android/ashmem.c +++ b/drivers/staging/android/ashmem.c @@ -834,16 +834,16 @@ static int __init ashmem_init(void) int ret; ashmem_area_cachep = kmem_cache_create(ashmem_area_cache, - sizeof(struct ashmem_area), - 0, 0, NULL); + sizeof(struct ashmem_area), + 0, 0, NULL); if (unlikely(!ashmem_area_cachep)) { pr_err(failed to create slab cache\n); return -ENOMEM; } ashmem_range_cachep = kmem_cache_create(ashmem_range_cache, - sizeof(struct ashmem_range), - 0, 0, NULL); + sizeof(struct ashmem_range), + 0, 0, NULL); if (unlikely(!ashmem_range_cachep)) { pr_err(failed to create slab cache\n); return -ENOMEM; diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c index 872bd60..61937ab 100644 --- a/drivers/staging/android/lowmemorykiller.c +++ b/drivers/staging/android/lowmemorykiller.c @@ -104,8 +104,8 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc) } lowmem_print(3, lowmem_scan %lu, %x, ofree %d %d, ma %hd\n, - sc-nr_to_scan, sc-gfp_mask, other_free, - other_file, min_score_adj); +sc-nr_to_scan, sc-gfp_mask, other_free, +other_file, min_score_adj); if (min_score_adj == OOM_SCORE_ADJ_MAX + 1) { lowmem_print(5, lowmem_scan %lu, %x, return 0\n, diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c index f83e00c..9a67d23 100644 --- a/drivers/staging/android/sync.c +++ b/drivers/staging/android/sync.c @@ -313,7 +313,7 @@ struct sync_fence *sync_fence_merge(const char *name, EXPORT_SYMBOL(sync_fence_merge); int sync_fence_wake_up_wq(wait_queue_t *curr, unsigned mode, -int wake_flags, void *key) + int wake_flags, void *key) { struct sync_fence_waiter *wait; @@ -353,7 +353,7 @@ int sync_fence_wait_async(struct sync_fence *fence, EXPORT_SYMBOL(sync_fence_wait_async); int sync_fence_cancel_async(struct sync_fence *fence, -struct sync_fence_waiter *waiter) + struct sync_fence_waiter *waiter) { unsigned long flags; int ret = 0; diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h index 61f8a3a..18a94ed 100644 --- a/drivers/staging/android/sync.h +++ b/drivers/staging/android/sync.h @@ -351,6 +351,6 @@ void sync_dump(void); # define sync_dump() #endif int sync_fence_wake_up_wq(wait_queue_t *curr, unsigned mode, -int wake_flags, void *key); + int wake_flags, void *key); #endif /* _LINUX_SYNC_H */ diff --git a/drivers/staging/android/timed_gpio.c b/drivers/staging/android/timed_gpio.c index ce11726..5407257 100644 --- a/drivers/staging/android/timed_gpio.c +++ b/drivers/staging/android/timed_gpio.c @@ -76,8 +76,9 @@ static void gpio_enable(struct timed_output_dev *dev, int value) value = data-max_timeout; hrtimer_start(data-timer, - ktime_set(value / 1000, (value % 1000) * 100), - HRTIMER_MODE_REL); + ktime_set(value / 1000, (value % 1000) * + 100), + HRTIMER_MODE_REL); } spin_unlock_irqrestore(data-lock, flags); @@ -94,8 +95,9 @@ static int timed_gpio_probe(struct platform_device *pdev) return -EBUSY; gpio_data = devm_kzalloc(pdev-dev, - sizeof(struct timed_gpio_data) * pdata-num_gpios, - GFP_KERNEL); +sizeof(struct timed_gpio_data) * +pdata-num_gpios, +GFP_KERNEL); if (!gpio_data) return -ENOMEM; @@ -104,7 +106,7 @@ static int timed_gpio_probe(struct platform_device *pdev) gpio_dat = gpio_data[i
[PATCH 2/8] fix staging:android style issue:No space is necessary after a cast
Signed-off-by: Peng Sun sironhide0n...@gmail.com --- drivers/staging/android/ashmem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c index b340ddc..1312600 100644 --- a/drivers/staging/android/ashmem.c +++ b/drivers/staging/android/ashmem.c @@ -716,7 +716,7 @@ static int ashmem_pin_unpin(struct ashmem_area *asma, unsigned long cmd, if (unlikely((pin.offset | pin.len) ~PAGE_MASK)) return -EINVAL; - if (unlikely(((__u32) -1) - pin.offset pin.len)) + if (unlikely(((__u32)-1) - pin.offset pin.len)) return -EINVAL; if (unlikely(PAGE_ALIGN(asma-size) pin.offset + pin.len)) @@ -760,7 +760,7 @@ static long ashmem_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ret = -EINVAL; if (!asma-file) { ret = 0; - asma-size = (size_t) arg; + asma-size = (size_t)arg; } break; case ASHMEM_GET_SIZE: -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 4/8] fix staging:android style issue:Prefer kernel type 'u32' over 'uint32_t'
Signed-off-by: Peng Sun sironhide0n...@gmail.com --- drivers/staging/android/lowmemorykiller.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c index 61937ab..78e1281 100644 --- a/drivers/staging/android/lowmemorykiller.c +++ b/drivers/staging/android/lowmemorykiller.c @@ -42,7 +42,7 @@ #include linux/profile.h #include linux/notifier.h -static uint32_t lowmem_debug_level = 1; +static u32 lowmem_debug_level = 1; static short lowmem_adj[6] = { 0, 1, -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 7/8] fix staging:android style issue:definition without comment
Signed-off-by: Peng Sun sironhide0n...@gmail.com --- drivers/staging/android/sync.h | 2 +- drivers/staging/android/timed_gpio.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h index 18a94ed..bb42923 100644 --- a/drivers/staging/android/sync.h +++ b/drivers/staging/android/sync.h @@ -94,11 +94,11 @@ struct sync_timeline { const struct sync_timeline_ops *ops; charname[32]; - /* protected by child_list_lock */ booldestroyed; int context, value; struct list_headchild_list_head; + /* protect field destroyed */ spinlock_t child_list_lock; struct list_headactive_list_head; diff --git a/drivers/staging/android/timed_gpio.c b/drivers/staging/android/timed_gpio.c index 5407257..5c55463 100644 --- a/drivers/staging/android/timed_gpio.c +++ b/drivers/staging/android/timed_gpio.c @@ -29,7 +29,7 @@ struct timed_gpio_data { struct timed_output_dev dev; struct hrtimer timer; - spinlock_t lock; + spinlock_t lock; /* protect structure fields */ unsigned gpio; int max_timeout; u8 active_low; -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 8/8] fix staging:android style issue:Please don't use multiple blank lines
Signed-off-by: Peng Sun sironhide0n...@gmail.com --- drivers/staging/android/timed_gpio.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/android/timed_gpio.c b/drivers/staging/android/timed_gpio.c index 5c55463..33acbbe 100644 --- a/drivers/staging/android/timed_gpio.c +++ b/drivers/staging/android/timed_gpio.c @@ -25,7 +25,6 @@ #include timed_output.h #include timed_gpio.h - struct timed_gpio_data { struct timed_output_dev dev; struct hrtimer timer; -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 5/8] fix staging:android style issue:Please use a blank line after function/struct/union/enum declarations
Signed-off-by: Peng Sun sironhide0n...@gmail.com --- drivers/staging/android/lowmemorykiller.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c index 78e1281..3f1311f 100644 --- a/drivers/staging/android/lowmemorykiller.c +++ b/drivers/staging/android/lowmemorykiller.c @@ -49,6 +49,7 @@ static short lowmem_adj[6] = { 6, 12, }; + static int lowmem_adj_size = 4; static int lowmem_minfree[6] = { 3 * 512,/* 6MB */ @@ -56,8 +57,8 @@ static int lowmem_minfree[6] = { 4 * 1024, /* 16MB */ 16 * 1024, /* 64MB */ }; -static int lowmem_minfree_size = 4; +static int lowmem_minfree_size = 4; static unsigned long lowmem_deathpending_timeout; #define lowmem_print(level, x...) \ -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 6/6] fix android/timed_gpio.c several coding style issues
Corrections based on checkpatch.pl with --strict 1) Please don't use multiple blank lines 2) spinlock_t definition without comment 3) Alignment should match open parenthesis Signed-off-by: Peng Sun sironhide0n...@gmail.com --- drivers/staging/android/timed_gpio.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/staging/android/timed_gpio.c b/drivers/staging/android/timed_gpio.c index ce11726..33acbbe 100644 --- a/drivers/staging/android/timed_gpio.c +++ b/drivers/staging/android/timed_gpio.c @@ -25,11 +25,10 @@ #include timed_output.h #include timed_gpio.h - struct timed_gpio_data { struct timed_output_dev dev; struct hrtimer timer; - spinlock_t lock; + spinlock_t lock; /* protect structure fields */ unsigned gpio; int max_timeout; u8 active_low; @@ -76,8 +75,9 @@ static void gpio_enable(struct timed_output_dev *dev, int value) value = data-max_timeout; hrtimer_start(data-timer, - ktime_set(value / 1000, (value % 1000) * 100), - HRTIMER_MODE_REL); + ktime_set(value / 1000, (value % 1000) * + 100), + HRTIMER_MODE_REL); } spin_unlock_irqrestore(data-lock, flags); @@ -94,8 +94,9 @@ static int timed_gpio_probe(struct platform_device *pdev) return -EBUSY; gpio_data = devm_kzalloc(pdev-dev, - sizeof(struct timed_gpio_data) * pdata-num_gpios, - GFP_KERNEL); +sizeof(struct timed_gpio_data) * +pdata-num_gpios, +GFP_KERNEL); if (!gpio_data) return -ENOMEM; @@ -104,7 +105,7 @@ static int timed_gpio_probe(struct platform_device *pdev) gpio_dat = gpio_data[i]; hrtimer_init(gpio_dat-timer, CLOCK_MONOTONIC, - HRTIMER_MODE_REL); +HRTIMER_MODE_REL); gpio_dat-timer.function = gpio_timer_func; spin_lock_init(gpio_dat-lock); -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/6] fix android/lowmemorykiller.c several coding style issues
Corrections based on checkpatch.pl with --strict 1) Prefer kernel type 'u32' over 'uint32_t' 2) Please use a blank line after function/struct/union/enum declarations 3) Alignment should match open parenthesis Signed-off-by: Peng Sun sironhide0n...@gmail.com --- drivers/staging/android/lowmemorykiller.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c index 872bd60..2315e41 100644 --- a/drivers/staging/android/lowmemorykiller.c +++ b/drivers/staging/android/lowmemorykiller.c @@ -42,13 +42,14 @@ #include linux/profile.h #include linux/notifier.h -static uint32_t lowmem_debug_level = 1; +static u32 lowmem_debug_level = 1; static short lowmem_adj[6] = { 0, 1, 6, 12, }; + static int lowmem_adj_size = 4; static int lowmem_minfree[6] = { 3 * 512,/* 6MB */ @@ -56,6 +57,7 @@ static int lowmem_minfree[6] = { 4 * 1024, /* 16MB */ 16 * 1024, /* 64MB */ }; + static int lowmem_minfree_size = 4; static unsigned long lowmem_deathpending_timeout; @@ -104,8 +106,8 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc) } lowmem_print(3, lowmem_scan %lu, %x, ofree %d %d, ma %hd\n, - sc-nr_to_scan, sc-gfp_mask, other_free, - other_file, min_score_adj); +sc-nr_to_scan, sc-gfp_mask, other_free, +other_file, min_score_adj); if (min_score_adj == OOM_SCORE_ADJ_MAX + 1) { lowmem_print(5, lowmem_scan %lu, %x, return 0\n, -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 0/6] fix drivers/staging/android several coding issues
patches based on linux-next next-20150824 Corrections based on checkpatch.pl with --strict Peng Sun (6): fix android/ashmem.c several coding style issues fix android/lowmemorykiller.c several coding style issues fix android/sw_sync.c several coding style issues fix android/sync.c several coding style issues fix android/sync.h several coding style issues fix android/timed_gpio.c several coding style issues drivers/staging/android/ashmem.c | 15 --- drivers/staging/android/lowmemorykiller.c | 8 +--- drivers/staging/android/sw_sync.c | 6 +++--- drivers/staging/android/sync.c| 22 +++--- drivers/staging/android/sync.h| 5 ++--- drivers/staging/android/timed_gpio.c | 15 --- 6 files changed, 37 insertions(+), 34 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/6] fix android/sw_sync.c several coding style issues
Corrections based on checkpatch.pl with --strict 1) Comparison to NULL could be written !obj 2) Comparison to NULL could be written !pt 3) Comparison to NULL could be written !fence Signed-off-by: Peng Sun sironhide0n...@gmail.com --- drivers/staging/android/sw_sync.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/android/sw_sync.c b/drivers/staging/android/sw_sync.c index c90838d..29b5c35 100644 --- a/drivers/staging/android/sw_sync.c +++ b/drivers/staging/android/sw_sync.c @@ -145,7 +145,7 @@ static int sw_sync_open(struct inode *inode, struct file *file) get_task_comm(task_comm, current); obj = sw_sync_timeline_create(task_comm); - if (obj == NULL) + if (!obj) return -ENOMEM; file-private_data = obj; @@ -179,14 +179,14 @@ static long sw_sync_ioctl_create_fence(struct sw_sync_timeline *obj, } pt = sw_sync_pt_create(obj, data.value); - if (pt == NULL) { + if (!pt) { err = -ENOMEM; goto err; } data.name[sizeof(data.name) - 1] = '\0'; fence = sync_fence_create(data.name, pt); - if (fence == NULL) { + if (!fence) { sync_pt_free(pt); err = -ENOMEM; goto err; -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 4/6] fix android/sync.c several coding style issues
Corrections based on checkpatch.pl with --strict 1) Comparison to NULL could be written !* 2) Alignment should match open parenthesis Signed-off-by: Peng Sun sironhide0n...@gmail.com --- drivers/staging/android/sync.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c index f83e00c..e0c1acb 100644 --- a/drivers/staging/android/sync.c +++ b/drivers/staging/android/sync.c @@ -43,7 +43,7 @@ struct sync_timeline *sync_timeline_create(const struct sync_timeline_ops *ops, return NULL; obj = kzalloc(size, GFP_KERNEL); - if (obj == NULL) + if (!obj) return NULL; kref_init(obj-kref); @@ -130,7 +130,7 @@ struct sync_pt *sync_pt_create(struct sync_timeline *obj, int size) return NULL; pt = kzalloc(size, GFP_KERNEL); - if (pt == NULL) + if (!pt) return NULL; spin_lock_irqsave(obj-child_list_lock, flags); @@ -155,7 +155,7 @@ static struct sync_fence *sync_fence_alloc(int size, const char *name) struct sync_fence *fence; fence = kzalloc(size, GFP_KERNEL); - if (fence == NULL) + if (!fence) return NULL; fence-file = anon_inode_getfile(sync_fence, sync_fence_fops, @@ -193,7 +193,7 @@ struct sync_fence *sync_fence_create(const char *name, struct sync_pt *pt) struct sync_fence *fence; fence = sync_fence_alloc(offsetof(struct sync_fence, cbs[1]), name); - if (fence == NULL) + if (!fence) return NULL; fence-num_fences = 1; @@ -215,7 +215,7 @@ struct sync_fence *sync_fence_fdget(int fd) { struct file *file = fget(fd); - if (file == NULL) + if (!file) return NULL; if (file-f_op != sync_fence_fops) @@ -262,7 +262,7 @@ struct sync_fence *sync_fence_merge(const char *name, unsigned long size = offsetof(struct sync_fence, cbs[num_fences]); fence = sync_fence_alloc(size, name); - if (fence == NULL) + if (!fence) return NULL; atomic_set(fence-status, num_fences); @@ -313,7 +313,7 @@ struct sync_fence *sync_fence_merge(const char *name, EXPORT_SYMBOL(sync_fence_merge); int sync_fence_wake_up_wq(wait_queue_t *curr, unsigned mode, -int wake_flags, void *key) + int wake_flags, void *key) { struct sync_fence_waiter *wait; @@ -353,7 +353,7 @@ int sync_fence_wait_async(struct sync_fence *fence, EXPORT_SYMBOL(sync_fence_wait_async); int sync_fence_cancel_async(struct sync_fence *fence, -struct sync_fence_waiter *waiter) + struct sync_fence_waiter *waiter) { unsigned long flags; int ret = 0; @@ -583,14 +583,14 @@ static long sync_fence_ioctl_merge(struct sync_fence *fence, unsigned long arg) } fence2 = sync_fence_fdget(data.fd2); - if (fence2 == NULL) { + if (!fence2) { err = -ENOENT; goto err_put_fd; } data.name[sizeof(data.name) - 1] = '\0'; fence3 = sync_fence_merge(data.name, fence, fence2); - if (fence3 == NULL) { + if (!fence3) { err = -ENOMEM; goto err_put_fence2; } @@ -666,7 +666,7 @@ static long sync_fence_ioctl_fence_info(struct sync_fence *fence, size = 4096; data = kzalloc(size, GFP_KERNEL); - if (data == NULL) + if (!data) return -ENOMEM; strlcpy(data-name, fence-name, sizeof(data-name)); -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 5/6] fix android/sync.h several coding style issues
Corrections based on checkpatch.pl with --strict 1) spinlock_t definition without comment 2) Alignment should match open parenthesis Signed-off-by: Peng Sun sironhide0n...@gmail.com --- drivers/staging/android/sync.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h index 61f8a3a..87358d2 100644 --- a/drivers/staging/android/sync.h +++ b/drivers/staging/android/sync.h @@ -94,12 +94,11 @@ struct sync_timeline { const struct sync_timeline_ops *ops; charname[32]; - /* protected by child_list_lock */ booldestroyed; int context, value; struct list_headchild_list_head; - spinlock_t child_list_lock; + spinlock_t child_list_lock; /* protect destroyed */ struct list_headactive_list_head; @@ -351,6 +350,6 @@ void sync_dump(void); # define sync_dump() #endif int sync_fence_wake_up_wq(wait_queue_t *curr, unsigned mode, -int wake_flags, void *key); + int wake_flags, void *key); #endif /* _LINUX_SYNC_H */ -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/6] fix android/ashmem.c several coding style issues
Corrections based on checkpatch.pl with --strict 1) spaces preferred around that '-' 2) No space is necessary after a case 3) Alignment should match open parenthesis Signed-off-by: Peng Sun sironhide0n...@gmail.com --- drivers/staging/android/ashmem.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c index 60200a3..d786ec1 100644 --- a/drivers/staging/android/ashmem.c +++ b/drivers/staging/android/ashmem.c @@ -618,7 +618,8 @@ static int ashmem_pin(struct ashmem_area *asma, size_t pgstart, size_t pgend) /* Case #3: We overlap from the rear, so adjust it */ if (range-pgend = pgend) { - range_shrink(range, range-pgstart, pgstart-1); + range_shrink(range, range-pgstart, +pgstart - 1); continue; } @@ -715,7 +716,7 @@ static int ashmem_pin_unpin(struct ashmem_area *asma, unsigned long cmd, if (unlikely((pin.offset | pin.len) ~PAGE_MASK)) return -EINVAL; - if (unlikely(((__u32) -1) - pin.offset pin.len)) + if (unlikely(((__u32)-1) - pin.offset pin.len)) return -EINVAL; if (unlikely(PAGE_ALIGN(asma-size) pin.offset + pin.len)) @@ -759,7 +760,7 @@ static long ashmem_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ret = -EINVAL; if (!asma-file) { ret = 0; - asma-size = (size_t) arg; + asma-size = (size_t)arg; } break; case ASHMEM_GET_SIZE: @@ -833,16 +834,16 @@ static int __init ashmem_init(void) int ret; ashmem_area_cachep = kmem_cache_create(ashmem_area_cache, - sizeof(struct ashmem_area), - 0, 0, NULL); + sizeof(struct ashmem_area), + 0, 0, NULL); if (unlikely(!ashmem_area_cachep)) { pr_err(failed to create slab cache\n); return -ENOMEM; } ashmem_range_cachep = kmem_cache_create(ashmem_range_cache, - sizeof(struct ashmem_range), - 0, 0, NULL); + sizeof(struct ashmem_range), + 0, 0, NULL); if (unlikely(!ashmem_range_cachep)) { pr_err(failed to create slab cache\n); return -ENOMEM; -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 6/6] fix android/sw_sync.c some coding style CHECK issues
Signed-off-by: Peng Sun --- drivers/staging/android/sw_sync.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/android/sw_sync.c b/drivers/staging/android/sw_sync.c index c90838d..29b5c35 100644 --- a/drivers/staging/android/sw_sync.c +++ b/drivers/staging/android/sw_sync.c @@ -145,7 +145,7 @@ static int sw_sync_open(struct inode *inode, struct file *file) get_task_comm(task_comm, current); obj = sw_sync_timeline_create(task_comm); - if (obj == NULL) + if (!obj) return -ENOMEM; file->private_data = obj; @@ -179,14 +179,14 @@ static long sw_sync_ioctl_create_fence(struct sw_sync_timeline *obj, } pt = sw_sync_pt_create(obj, data.value); - if (pt == NULL) { + if (!pt) { err = -ENOMEM; goto err; } data.name[sizeof(data.name) - 1] = '\0'; fence = sync_fence_create(data.name, pt); - if (fence == NULL) { + if (!fence) { sync_pt_free(pt); err = -ENOMEM; goto err; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/6] fix android/sync.c some coding style issues
Signed-off-by: Peng Sun --- drivers/staging/android/sync.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c index f83e00c..e0c1acb 100644 --- a/drivers/staging/android/sync.c +++ b/drivers/staging/android/sync.c @@ -43,7 +43,7 @@ struct sync_timeline *sync_timeline_create(const struct sync_timeline_ops *ops, return NULL; obj = kzalloc(size, GFP_KERNEL); - if (obj == NULL) + if (!obj) return NULL; kref_init(>kref); @@ -130,7 +130,7 @@ struct sync_pt *sync_pt_create(struct sync_timeline *obj, int size) return NULL; pt = kzalloc(size, GFP_KERNEL); - if (pt == NULL) + if (!pt) return NULL; spin_lock_irqsave(>child_list_lock, flags); @@ -155,7 +155,7 @@ static struct sync_fence *sync_fence_alloc(int size, const char *name) struct sync_fence *fence; fence = kzalloc(size, GFP_KERNEL); - if (fence == NULL) + if (!fence) return NULL; fence->file = anon_inode_getfile("sync_fence", _fence_fops, @@ -193,7 +193,7 @@ struct sync_fence *sync_fence_create(const char *name, struct sync_pt *pt) struct sync_fence *fence; fence = sync_fence_alloc(offsetof(struct sync_fence, cbs[1]), name); - if (fence == NULL) + if (!fence) return NULL; fence->num_fences = 1; @@ -215,7 +215,7 @@ struct sync_fence *sync_fence_fdget(int fd) { struct file *file = fget(fd); - if (file == NULL) + if (!file) return NULL; if (file->f_op != _fence_fops) @@ -262,7 +262,7 @@ struct sync_fence *sync_fence_merge(const char *name, unsigned long size = offsetof(struct sync_fence, cbs[num_fences]); fence = sync_fence_alloc(size, name); - if (fence == NULL) + if (!fence) return NULL; atomic_set(>status, num_fences); @@ -313,7 +313,7 @@ struct sync_fence *sync_fence_merge(const char *name, EXPORT_SYMBOL(sync_fence_merge); int sync_fence_wake_up_wq(wait_queue_t *curr, unsigned mode, -int wake_flags, void *key) + int wake_flags, void *key) { struct sync_fence_waiter *wait; @@ -353,7 +353,7 @@ int sync_fence_wait_async(struct sync_fence *fence, EXPORT_SYMBOL(sync_fence_wait_async); int sync_fence_cancel_async(struct sync_fence *fence, -struct sync_fence_waiter *waiter) + struct sync_fence_waiter *waiter) { unsigned long flags; int ret = 0; @@ -583,14 +583,14 @@ static long sync_fence_ioctl_merge(struct sync_fence *fence, unsigned long arg) } fence2 = sync_fence_fdget(data.fd2); - if (fence2 == NULL) { + if (!fence2) { err = -ENOENT; goto err_put_fd; } data.name[sizeof(data.name) - 1] = '\0'; fence3 = sync_fence_merge(data.name, fence, fence2); - if (fence3 == NULL) { + if (!fence3) { err = -ENOMEM; goto err_put_fence2; } @@ -666,7 +666,7 @@ static long sync_fence_ioctl_fence_info(struct sync_fence *fence, size = 4096; data = kzalloc(size, GFP_KERNEL); - if (data == NULL) + if (!data) return -ENOMEM; strlcpy(data->name, fence->name, sizeof(data->name)); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 5/6] fix android/timed_gpio.c some coding style CHECK issues
Signed-off-by: Peng Sun --- drivers/staging/android/timed_gpio.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/staging/android/timed_gpio.c b/drivers/staging/android/timed_gpio.c index ce11726..33acbbe 100644 --- a/drivers/staging/android/timed_gpio.c +++ b/drivers/staging/android/timed_gpio.c @@ -25,11 +25,10 @@ #include "timed_output.h" #include "timed_gpio.h" - struct timed_gpio_data { struct timed_output_dev dev; struct hrtimer timer; - spinlock_t lock; + spinlock_t lock; /* protect structure fields */ unsigned gpio; int max_timeout; u8 active_low; @@ -76,8 +75,9 @@ static void gpio_enable(struct timed_output_dev *dev, int value) value = data->max_timeout; hrtimer_start(>timer, - ktime_set(value / 1000, (value % 1000) * 100), - HRTIMER_MODE_REL); + ktime_set(value / 1000, (value % 1000) * + 100), + HRTIMER_MODE_REL); } spin_unlock_irqrestore(>lock, flags); @@ -94,8 +94,9 @@ static int timed_gpio_probe(struct platform_device *pdev) return -EBUSY; gpio_data = devm_kzalloc(>dev, - sizeof(struct timed_gpio_data) * pdata->num_gpios, - GFP_KERNEL); +sizeof(struct timed_gpio_data) * +pdata->num_gpios, +GFP_KERNEL); if (!gpio_data) return -ENOMEM; @@ -104,7 +105,7 @@ static int timed_gpio_probe(struct platform_device *pdev) gpio_dat = _data[i]; hrtimer_init(_dat->timer, CLOCK_MONOTONIC, - HRTIMER_MODE_REL); +HRTIMER_MODE_REL); gpio_dat->timer.function = gpio_timer_func; spin_lock_init(_dat->lock); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 4/6] fix android/sync.h some coding style CHECK issues
Signed-off-by: Peng Sun --- drivers/staging/android/sync.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h index 61f8a3a..71fb800 100644 --- a/drivers/staging/android/sync.h +++ b/drivers/staging/android/sync.h @@ -94,12 +94,11 @@ struct sync_timeline { const struct sync_timeline_ops *ops; charname[32]; - /* protected by child_list_lock */ booldestroyed; int context, value; struct list_headchild_list_head; - spinlock_t child_list_lock; + spinlock_t child_list_lock; /* protected destroyed */ struct list_headactive_list_head; @@ -351,6 +350,6 @@ void sync_dump(void); # define sync_dump() #endif int sync_fence_wake_up_wq(wait_queue_t *curr, unsigned mode, -int wake_flags, void *key); + int wake_flags, void *key); #endif /* _LINUX_SYNC_H */ -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/6] fix android/lowmemorykiller.c several coding style
Signed-off-by: Peng Sun --- drivers/staging/android/lowmemorykiller.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c index 872bd60..3f1311f 100644 --- a/drivers/staging/android/lowmemorykiller.c +++ b/drivers/staging/android/lowmemorykiller.c @@ -42,13 +42,14 @@ #include #include -static uint32_t lowmem_debug_level = 1; +static u32 lowmem_debug_level = 1; static short lowmem_adj[6] = { 0, 1, 6, 12, }; + static int lowmem_adj_size = 4; static int lowmem_minfree[6] = { 3 * 512,/* 6MB */ @@ -56,8 +57,8 @@ static int lowmem_minfree[6] = { 4 * 1024, /* 16MB */ 16 * 1024, /* 64MB */ }; -static int lowmem_minfree_size = 4; +static int lowmem_minfree_size = 4; static unsigned long lowmem_deathpending_timeout; #define lowmem_print(level, x...) \ @@ -104,8 +105,8 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc) } lowmem_print(3, "lowmem_scan %lu, %x, ofree %d %d, ma %hd\n", - sc->nr_to_scan, sc->gfp_mask, other_free, - other_file, min_score_adj); +sc->nr_to_scan, sc->gfp_mask, other_free, +other_file, min_score_adj); if (min_score_adj == OOM_SCORE_ADJ_MAX + 1) { lowmem_print(5, "lowmem_scan %lu, %x, return 0\n", -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 0/6] fix drivers/staging/android some coding style issues
patches based on commit f0359ead9129821e4b3b5486e7837d3001a95574 linux-next next-20150820 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/6] fix android/ashmem.c several coding style
Signed-off-by: Peng Sun --- drivers/staging/android/ashmem.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c index 60200a3..d786ec1 100644 --- a/drivers/staging/android/ashmem.c +++ b/drivers/staging/android/ashmem.c @@ -618,7 +618,8 @@ static int ashmem_pin(struct ashmem_area *asma, size_t pgstart, size_t pgend) /* Case #3: We overlap from the rear, so adjust it */ if (range->pgend <= pgend) { - range_shrink(range, range->pgstart, pgstart-1); + range_shrink(range, range->pgstart, +pgstart - 1); continue; } @@ -715,7 +716,7 @@ static int ashmem_pin_unpin(struct ashmem_area *asma, unsigned long cmd, if (unlikely((pin.offset | pin.len) & ~PAGE_MASK)) return -EINVAL; - if (unlikely(((__u32) -1) - pin.offset < pin.len)) + if (unlikely(((__u32)-1) - pin.offset < pin.len)) return -EINVAL; if (unlikely(PAGE_ALIGN(asma->size) < pin.offset + pin.len)) @@ -759,7 +760,7 @@ static long ashmem_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ret = -EINVAL; if (!asma->file) { ret = 0; - asma->size = (size_t) arg; + asma->size = (size_t)arg; } break; case ASHMEM_GET_SIZE: @@ -833,16 +834,16 @@ static int __init ashmem_init(void) int ret; ashmem_area_cachep = kmem_cache_create("ashmem_area_cache", - sizeof(struct ashmem_area), - 0, 0, NULL); + sizeof(struct ashmem_area), + 0, 0, NULL); if (unlikely(!ashmem_area_cachep)) { pr_err("failed to create slab cache\n"); return -ENOMEM; } ashmem_range_cachep = kmem_cache_create("ashmem_range_cache", - sizeof(struct ashmem_range), - 0, 0, NULL); + sizeof(struct ashmem_range), + 0, 0, NULL); if (unlikely(!ashmem_range_cachep)) { pr_err("failed to create slab cache\n"); return -ENOMEM; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 0/6] fix drivers/staging/android some coding style issues
patches based on commit f0359ead9129821e4b3b5486e7837d3001a95574 linux-next next-20150820 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/6] fix android/ashmem.c several coding style
Signed-off-by: Peng Sun sironhide0n...@gmail.com --- drivers/staging/android/ashmem.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c index 60200a3..d786ec1 100644 --- a/drivers/staging/android/ashmem.c +++ b/drivers/staging/android/ashmem.c @@ -618,7 +618,8 @@ static int ashmem_pin(struct ashmem_area *asma, size_t pgstart, size_t pgend) /* Case #3: We overlap from the rear, so adjust it */ if (range-pgend = pgend) { - range_shrink(range, range-pgstart, pgstart-1); + range_shrink(range, range-pgstart, +pgstart - 1); continue; } @@ -715,7 +716,7 @@ static int ashmem_pin_unpin(struct ashmem_area *asma, unsigned long cmd, if (unlikely((pin.offset | pin.len) ~PAGE_MASK)) return -EINVAL; - if (unlikely(((__u32) -1) - pin.offset pin.len)) + if (unlikely(((__u32)-1) - pin.offset pin.len)) return -EINVAL; if (unlikely(PAGE_ALIGN(asma-size) pin.offset + pin.len)) @@ -759,7 +760,7 @@ static long ashmem_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ret = -EINVAL; if (!asma-file) { ret = 0; - asma-size = (size_t) arg; + asma-size = (size_t)arg; } break; case ASHMEM_GET_SIZE: @@ -833,16 +834,16 @@ static int __init ashmem_init(void) int ret; ashmem_area_cachep = kmem_cache_create(ashmem_area_cache, - sizeof(struct ashmem_area), - 0, 0, NULL); + sizeof(struct ashmem_area), + 0, 0, NULL); if (unlikely(!ashmem_area_cachep)) { pr_err(failed to create slab cache\n); return -ENOMEM; } ashmem_range_cachep = kmem_cache_create(ashmem_range_cache, - sizeof(struct ashmem_range), - 0, 0, NULL); + sizeof(struct ashmem_range), + 0, 0, NULL); if (unlikely(!ashmem_range_cachep)) { pr_err(failed to create slab cache\n); return -ENOMEM; -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 6/6] fix android/sw_sync.c some coding style CHECK issues
Signed-off-by: Peng Sun sironhide0n...@gmail.com --- drivers/staging/android/sw_sync.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/android/sw_sync.c b/drivers/staging/android/sw_sync.c index c90838d..29b5c35 100644 --- a/drivers/staging/android/sw_sync.c +++ b/drivers/staging/android/sw_sync.c @@ -145,7 +145,7 @@ static int sw_sync_open(struct inode *inode, struct file *file) get_task_comm(task_comm, current); obj = sw_sync_timeline_create(task_comm); - if (obj == NULL) + if (!obj) return -ENOMEM; file-private_data = obj; @@ -179,14 +179,14 @@ static long sw_sync_ioctl_create_fence(struct sw_sync_timeline *obj, } pt = sw_sync_pt_create(obj, data.value); - if (pt == NULL) { + if (!pt) { err = -ENOMEM; goto err; } data.name[sizeof(data.name) - 1] = '\0'; fence = sync_fence_create(data.name, pt); - if (fence == NULL) { + if (!fence) { sync_pt_free(pt); err = -ENOMEM; goto err; -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/6] fix android/sync.c some coding style issues
Signed-off-by: Peng Sun sironhide0n...@gmail.com --- drivers/staging/android/sync.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c index f83e00c..e0c1acb 100644 --- a/drivers/staging/android/sync.c +++ b/drivers/staging/android/sync.c @@ -43,7 +43,7 @@ struct sync_timeline *sync_timeline_create(const struct sync_timeline_ops *ops, return NULL; obj = kzalloc(size, GFP_KERNEL); - if (obj == NULL) + if (!obj) return NULL; kref_init(obj-kref); @@ -130,7 +130,7 @@ struct sync_pt *sync_pt_create(struct sync_timeline *obj, int size) return NULL; pt = kzalloc(size, GFP_KERNEL); - if (pt == NULL) + if (!pt) return NULL; spin_lock_irqsave(obj-child_list_lock, flags); @@ -155,7 +155,7 @@ static struct sync_fence *sync_fence_alloc(int size, const char *name) struct sync_fence *fence; fence = kzalloc(size, GFP_KERNEL); - if (fence == NULL) + if (!fence) return NULL; fence-file = anon_inode_getfile(sync_fence, sync_fence_fops, @@ -193,7 +193,7 @@ struct sync_fence *sync_fence_create(const char *name, struct sync_pt *pt) struct sync_fence *fence; fence = sync_fence_alloc(offsetof(struct sync_fence, cbs[1]), name); - if (fence == NULL) + if (!fence) return NULL; fence-num_fences = 1; @@ -215,7 +215,7 @@ struct sync_fence *sync_fence_fdget(int fd) { struct file *file = fget(fd); - if (file == NULL) + if (!file) return NULL; if (file-f_op != sync_fence_fops) @@ -262,7 +262,7 @@ struct sync_fence *sync_fence_merge(const char *name, unsigned long size = offsetof(struct sync_fence, cbs[num_fences]); fence = sync_fence_alloc(size, name); - if (fence == NULL) + if (!fence) return NULL; atomic_set(fence-status, num_fences); @@ -313,7 +313,7 @@ struct sync_fence *sync_fence_merge(const char *name, EXPORT_SYMBOL(sync_fence_merge); int sync_fence_wake_up_wq(wait_queue_t *curr, unsigned mode, -int wake_flags, void *key) + int wake_flags, void *key) { struct sync_fence_waiter *wait; @@ -353,7 +353,7 @@ int sync_fence_wait_async(struct sync_fence *fence, EXPORT_SYMBOL(sync_fence_wait_async); int sync_fence_cancel_async(struct sync_fence *fence, -struct sync_fence_waiter *waiter) + struct sync_fence_waiter *waiter) { unsigned long flags; int ret = 0; @@ -583,14 +583,14 @@ static long sync_fence_ioctl_merge(struct sync_fence *fence, unsigned long arg) } fence2 = sync_fence_fdget(data.fd2); - if (fence2 == NULL) { + if (!fence2) { err = -ENOENT; goto err_put_fd; } data.name[sizeof(data.name) - 1] = '\0'; fence3 = sync_fence_merge(data.name, fence, fence2); - if (fence3 == NULL) { + if (!fence3) { err = -ENOMEM; goto err_put_fence2; } @@ -666,7 +666,7 @@ static long sync_fence_ioctl_fence_info(struct sync_fence *fence, size = 4096; data = kzalloc(size, GFP_KERNEL); - if (data == NULL) + if (!data) return -ENOMEM; strlcpy(data-name, fence-name, sizeof(data-name)); -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 5/6] fix android/timed_gpio.c some coding style CHECK issues
Signed-off-by: Peng Sun sironhide0n...@gmail.com --- drivers/staging/android/timed_gpio.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/staging/android/timed_gpio.c b/drivers/staging/android/timed_gpio.c index ce11726..33acbbe 100644 --- a/drivers/staging/android/timed_gpio.c +++ b/drivers/staging/android/timed_gpio.c @@ -25,11 +25,10 @@ #include timed_output.h #include timed_gpio.h - struct timed_gpio_data { struct timed_output_dev dev; struct hrtimer timer; - spinlock_t lock; + spinlock_t lock; /* protect structure fields */ unsigned gpio; int max_timeout; u8 active_low; @@ -76,8 +75,9 @@ static void gpio_enable(struct timed_output_dev *dev, int value) value = data-max_timeout; hrtimer_start(data-timer, - ktime_set(value / 1000, (value % 1000) * 100), - HRTIMER_MODE_REL); + ktime_set(value / 1000, (value % 1000) * + 100), + HRTIMER_MODE_REL); } spin_unlock_irqrestore(data-lock, flags); @@ -94,8 +94,9 @@ static int timed_gpio_probe(struct platform_device *pdev) return -EBUSY; gpio_data = devm_kzalloc(pdev-dev, - sizeof(struct timed_gpio_data) * pdata-num_gpios, - GFP_KERNEL); +sizeof(struct timed_gpio_data) * +pdata-num_gpios, +GFP_KERNEL); if (!gpio_data) return -ENOMEM; @@ -104,7 +105,7 @@ static int timed_gpio_probe(struct platform_device *pdev) gpio_dat = gpio_data[i]; hrtimer_init(gpio_dat-timer, CLOCK_MONOTONIC, - HRTIMER_MODE_REL); +HRTIMER_MODE_REL); gpio_dat-timer.function = gpio_timer_func; spin_lock_init(gpio_dat-lock); -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/