OSDN Git Service

ANDROID: usb: gadget: audio_source: fix comparison of distinct pointer types
authorAmit Pundir <amit.pundir@linaro.org>
Thu, 15 Sep 2016 10:35:40 +0000 (16:05 +0530)
committerDmitry Shmidt <dimitrysh@google.com>
Mon, 7 Nov 2016 21:54:51 +0000 (13:54 -0800)
Use div_s64() instead of do_div() to fix following "comparison of
distinct pointer types lacks a cast" warning in do_div() call in
audio_send() for ARCH=arm in Linux 4.8-rc6:

  CC      drivers/usb/gadget/function/f_audio_source.o
In file included from ./arch/arm/include/asm/div64.h:126:0,
                 from ./include/linux/kernel.h:142,
                 from ./include/linux/list.h:8,
                 from ./include/linux/kobject.h:20,
                 from ./include/linux/device.h:17,
                 from drivers/usb/gadget/function/f_audio_source.c:17:
drivers/usb/gadget/function/f_audio_source.c: In function ‘audio_send’:
./include/asm-generic/div64.h:207:28: warning: comparison of distinct pointer types lacks a cast
  (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
                            ^
drivers/usb/gadget/function/f_audio_source.c:381:2: note: in expansion of macro ‘do_div’
  do_div(msecs, 1000000);
  ^
./include/asm-generic/div64.h:207:28: warning: comparison of distinct pointer types lacks a cast
  (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
                            ^
drivers/usb/gadget/function/f_audio_source.c:383:2: note: in expansion of macro ‘do_div’
  do_div(frames, 1000);
  ^
  LD      drivers/usb/gadget/function/usb_f_audio_source.o

Change-Id: Ie1a920c8948f3fc3f1263add25a402ded132fd66
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
drivers/usb/gadget/function/f_audio_source.c

index bcd8174..2489a5f 100644 (file)
@@ -377,10 +377,9 @@ static void audio_send(struct audio_dev *audio)
 
        /* compute number of frames to send */
        now = ktime_get();
-       msecs = ktime_to_ns(now) - ktime_to_ns(audio->start_time);
-       do_div(msecs, 1000000);
-       frames = msecs * SAMPLE_RATE;
-       do_div(frames, 1000);
+       msecs = div_s64((ktime_to_ns(now) - ktime_to_ns(audio->start_time)),
+                       1000000);
+       frames = div_s64((msecs * SAMPLE_RATE), 1000);
 
        /* Readjust our frames_sent if we fall too far behind.
         * If we get too far behind it is better to drop some frames than