Skip to content

Commit 7d3ac5c

Browse files
Saharadavem330
authored andcommitted
ptp_pch: eliminate a number of sparse warnings
This fixes a number of sparse warnings like: warning: incorrect type in argument 2 (different address spaces) expected void volatile [noderef] <asn:2>*addr got unsigned int *<noident> warning: Using plain integer as NULL pointer Additionally this fixes a warning from checkpatch.pl like: WARNING: sizeof pch_param.station should be sizeof(pch_param.station) Signed-off-by: Sahara <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6bdeaba commit 7d3ac5c

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

drivers/ptp/ptp_pch.c

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ struct pch_ts_regs {
118118
* struct pch_dev - Driver private data
119119
*/
120120
struct pch_dev {
121-
struct pch_ts_regs *regs;
121+
struct pch_ts_regs __iomem *regs;
122122
struct ptp_clock *ptp_clock;
123123
struct ptp_clock_info caps;
124124
int exts0_enabled;
@@ -154,7 +154,7 @@ static inline void pch_eth_enable_set(struct pch_dev *chip)
154154
iowrite32(val, (&chip->regs->ts_sel));
155155
}
156156

157-
static u64 pch_systime_read(struct pch_ts_regs *regs)
157+
static u64 pch_systime_read(struct pch_ts_regs __iomem *regs)
158158
{
159159
u64 ns;
160160
u32 lo, hi;
@@ -169,7 +169,7 @@ static u64 pch_systime_read(struct pch_ts_regs *regs)
169169
return ns;
170170
}
171171

172-
static void pch_systime_write(struct pch_ts_regs *regs, u64 ns)
172+
static void pch_systime_write(struct pch_ts_regs __iomem *regs, u64 ns)
173173
{
174174
u32 hi, lo;
175175

@@ -315,7 +315,7 @@ int pch_set_station_address(u8 *addr, struct pci_dev *pdev)
315315
struct pch_dev *chip = pci_get_drvdata(pdev);
316316

317317
/* Verify the parameter */
318-
if ((chip->regs == 0) || addr == (u8 *)NULL) {
318+
if ((chip->regs == NULL) || addr == (u8 *)NULL) {
319319
dev_err(&pdev->dev,
320320
"invalid params returning PCH_INVALIDPARAM\n");
321321
return PCH_INVALIDPARAM;
@@ -361,7 +361,7 @@ EXPORT_SYMBOL(pch_set_station_address);
361361
static irqreturn_t isr(int irq, void *priv)
362362
{
363363
struct pch_dev *pch_dev = priv;
364-
struct pch_ts_regs *regs = pch_dev->regs;
364+
struct pch_ts_regs __iomem *regs = pch_dev->regs;
365365
struct ptp_clock_event event;
366366
u32 ack = 0, lo, hi, val;
367367

@@ -415,7 +415,7 @@ static int ptp_pch_adjfreq(struct ptp_clock_info *ptp, s32 ppb)
415415
u32 diff, addend;
416416
int neg_adj = 0;
417417
struct pch_dev *pch_dev = container_of(ptp, struct pch_dev, caps);
418-
struct pch_ts_regs *regs = pch_dev->regs;
418+
struct pch_ts_regs __iomem *regs = pch_dev->regs;
419419

420420
if (ppb < 0) {
421421
neg_adj = 1;
@@ -438,7 +438,7 @@ static int ptp_pch_adjtime(struct ptp_clock_info *ptp, s64 delta)
438438
s64 now;
439439
unsigned long flags;
440440
struct pch_dev *pch_dev = container_of(ptp, struct pch_dev, caps);
441-
struct pch_ts_regs *regs = pch_dev->regs;
441+
struct pch_ts_regs __iomem *regs = pch_dev->regs;
442442

443443
spin_lock_irqsave(&pch_dev->register_lock, flags);
444444
now = pch_systime_read(regs);
@@ -455,7 +455,7 @@ static int ptp_pch_gettime(struct ptp_clock_info *ptp, struct timespec *ts)
455455
u32 remainder;
456456
unsigned long flags;
457457
struct pch_dev *pch_dev = container_of(ptp, struct pch_dev, caps);
458-
struct pch_ts_regs *regs = pch_dev->regs;
458+
struct pch_ts_regs __iomem *regs = pch_dev->regs;
459459

460460
spin_lock_irqsave(&pch_dev->register_lock, flags);
461461
ns = pch_systime_read(regs);
@@ -472,7 +472,7 @@ static int ptp_pch_settime(struct ptp_clock_info *ptp,
472472
u64 ns;
473473
unsigned long flags;
474474
struct pch_dev *pch_dev = container_of(ptp, struct pch_dev, caps);
475-
struct pch_ts_regs *regs = pch_dev->regs;
475+
struct pch_ts_regs __iomem *regs = pch_dev->regs;
476476

477477
ns = ts->tv_sec * 1000000000ULL;
478478
ns += ts->tv_nsec;
@@ -567,9 +567,9 @@ static void pch_remove(struct pci_dev *pdev)
567567
free_irq(pdev->irq, chip);
568568

569569
/* unmap the virtual IO memory space */
570-
if (chip->regs != 0) {
570+
if (chip->regs != NULL) {
571571
iounmap(chip->regs);
572-
chip->regs = 0;
572+
chip->regs = NULL;
573573
}
574574
/* release the reserved IO memory space */
575575
if (chip->mem_base != 0) {
@@ -670,7 +670,7 @@ pch_probe(struct pci_dev *pdev, const struct pci_device_id *id)
670670
err_req_irq:
671671
ptp_clock_unregister(chip->ptp_clock);
672672
iounmap(chip->regs);
673-
chip->regs = 0;
673+
chip->regs = NULL;
674674

675675
err_ioremap:
676676
release_mem_region(chip->mem_base, chip->mem_size);
@@ -723,7 +723,8 @@ static s32 __init ptp_pch_init(void)
723723
module_init(ptp_pch_init);
724724
module_exit(ptp_pch_exit);
725725

726-
module_param_string(station, pch_param.station, sizeof pch_param.station, 0444);
726+
module_param_string(station,
727+
pch_param.station, sizeof(pch_param.station), 0444);
727728
MODULE_PARM_DESC(station,
728729
"IEEE 1588 station address to use - colon separated hex values");
729730

0 commit comments

Comments
 (0)