Re: [PATCH 1/7] LinuxPPS core support.

From: Rodolfo Giometti
Date: Tue Apr 01 2008 - 05:40:36 EST


On Tue, Apr 01, 2008 at 02:09:46AM -0700, Andrew Morton wrote:
> On Tue, 1 Apr 2008 10:59:50 +0200 Rodolfo Giometti <giometti@xxxxxxxxxxxx> wrote:
>
> > On Fri, Mar 28, 2008 at 03:21:39AM -0700, Andrew Morton wrote:
> > > On Thu, 6 Mar 2008 13:09:00 +0100 Rodolfo Giometti <giometti@xxxxxxxx> wrote:
> > >
> > > > This patch adds the kernel side of the PPS support currently named
> > > > "LinuxPPS".
> > >
> > > powerpc:
> > >
> > > drivers/pps/pps.c: In function 'pps_cdev_ioctl':
> > > drivers/pps/pps.c:166: warning: format '%lld' expects type 'long long int', but argument 2 has type '__s64'
> > > drivers/pps/kapi.c: In function 'pps_event':
> > > drivers/pps/kapi.c:225: warning: format '%llu' expects type 'long long unsigned int', but argument 3 has type '__s64'
> > > drivers/pps/sysfs.c: In function 'pps_show_assert':
> > > drivers/pps/sysfs.c:42: warning: format '%lld' expects type 'long long int', but argument 3 has type '__s64'
> > > drivers/pps/sysfs.c:42: warning: format '%lld' expects type 'long long int', but argument 3 has type '__s64'
> > > drivers/pps/sysfs.c: In function 'pps_show_clear':
> > > drivers/pps/sysfs.c:56: warning: format '%lld' expects type 'long long int', but argument 3 has type '__s64'
> > > drivers/pps/sysfs.c:56: warning: format '%lld' expects type 'long long int', but argument 3 has type '__s64'
> >
> > Oops! I have no powerpc system... how can I solve this issue?
>
> Use %lld (if these things can legitimately be negative - otherwise %llu)
> and cast the argument to (long long) or (unsigned long long).

Ok, here my modifications:

diff --git a/drivers/pps/kapi.c b/drivers/pps/kapi.c
index 34b3b22..d75c8c8 100644
--- a/drivers/pps/kapi.c
+++ b/drivers/pps/kapi.c
@@ -245,7 +245,7 @@ void pps_event(int source, int event, void *data)
return;

pr_debug("PPS event on source %d at %llu.%06u\n",
- pps->id, ts.sec, ts.nsec);
+ pps->id, (unsigned long long) ts.sec, ts.nsec);

spin_lock_irqsave(&pps->lock, flags);

diff --git a/drivers/pps/pps.c b/drivers/pps/pps.c
index a82b1d8..5cbfeb9 100644
--- a/drivers/pps/pps.c
+++ b/drivers/pps/pps.c
@@ -164,7 +164,8 @@ static int pps_cdev_ioctl(struct inode *inode, struct file *
err = wait_event_interruptible(pps->queue, pps->go);
else {
pr_debug("timeout %lld.%09d\n",
- fdata.timeout.sec, fdata.timeout.nsec);
+ (long long) fdata.timeout.sec,
+ fdata.timeout.nsec);
ticks = fdata.timeout.sec * HZ;
ticks += fdata.timeout.nsec / (NSEC_PER_SEC / HZ);

diff --git a/drivers/pps/sysfs.c b/drivers/pps/sysfs.c
index 3af773a..0520f62 100644
--- a/drivers/pps/sysfs.c
+++ b/drivers/pps/sysfs.c
@@ -38,7 +38,7 @@ static ssize_t pps_show_assert(struct device *dev,
return 0;

return sprintf(buf, "%lld.%09d#%d\n",
- pps->assert_tu.sec, pps->assert_tu.nsec,
+ (long long) pps->assert_tu.sec, pps->assert_tu.nsec,
pps->assert_sequence);
}
DEVICE_ATTR(assert, S_IRUGO, pps_show_assert, NULL);
@@ -52,7 +52,7 @@ static ssize_t pps_show_clear(struct device *dev,
return 0;

return sprintf(buf, "%lld.%09d#%d\n",
- pps->clear_tu.sec, pps->clear_tu.nsec,
+ (long long) pps->clear_tu.sec, pps->clear_tu.nsec,
pps->clear_sequence);
}
DEVICE_ATTR(clear, S_IRUGO, pps_show_clear, NULL);

This compile clearly on x86. I'm going to propose a new patch ASAP.

Thanks,

Rodolfo

--

GNU/Linux Solutions e-mail: giometti@xxxxxxxxxxxx
Linux Device Driver giometti@xxxxxxxxx
Embedded Systems giometti@xxxxxxxx
UNIX programming phone: +39 349 2432127
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/