drivers: misc: ti-st: Use int instead of fuzzy char for callback status
authorGeert Uytterhoeven <geert@linux-m68k.org>
Mon, 6 Jun 2016 09:02:03 +0000 (11:02 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Sun, 17 Jul 2016 17:59:26 +0000 (19:59 +0200)
On mips and parisc:

    drivers/bluetooth/btwilink.c: In function 'ti_st_open':
    drivers/bluetooth/btwilink.c:174:21: warning: overflow in implicit constant conversion [-Woverflow]
       hst->reg_status = -EINPROGRESS;

    drivers/nfc/nfcwilink.c: In function 'nfcwilink_open':
    drivers/nfc/nfcwilink.c:396:31: warning: overflow in implicit constant conversion [-Woverflow]
      drv->st_register_cb_status = -EINPROGRESS;

There are actually two issues:
  1. Whether "char" is signed or unsigned depends on the architecture.
     As the completion callback data is used to pass a (negative) error
     code, it should always be signed.
  2. EINPROGRESS is 150 on mips, 245 on parisc.
     Hence -EINPROGRESS doesn't fit in a signed 8-bit number.

Change the callback status from "char" to "int" to fix these.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
drivers/bluetooth/btwilink.c
drivers/media/radio/wl128x/fmdrv_common.c
drivers/misc/ti-st/st_core.c
drivers/nfc/nfcwilink.c
include/linux/ti_wilink_st.h

index 24a652f..485281b 100644 (file)
@@ -51,7 +51,7 @@
  */
 struct ti_st {
        struct hci_dev *hdev;
-       char reg_status;
+       int reg_status;
        long (*st_write) (struct sk_buff *);
        struct completion wait_reg_completion;
 };
@@ -83,7 +83,7 @@ static inline void ti_st_tx_complete(struct ti_st *hst, int pkt_type)
  * status.ti_st_open() function will wait for signal from this
  * API when st_register() function returns ST_PENDING.
  */
-static void st_reg_completion_cb(void *priv_data, char data)
+static void st_reg_completion_cb(void *priv_data, int data)
 {
        struct ti_st *lhst = priv_data;
 
index 3f9e6df..642b89c 100644 (file)
@@ -1472,7 +1472,7 @@ static long fm_st_receive(void *arg, struct sk_buff *skb)
  * Called by ST layer to indicate protocol registration completion
  * status.
  */
-static void fm_st_reg_comp_cb(void *arg, char data)
+static void fm_st_reg_comp_cb(void *arg, int data)
 {
        struct fmdev *fmdev;
 
index dcdbd58..0005159 100644 (file)
@@ -141,7 +141,7 @@ static void st_send_frame(unsigned char chnl_id, struct st_data_s *st_gdata)
  * This function is being called with spin lock held, protocol drivers are
  * only expected to complete their waits and do nothing more than that.
  */
-static void st_reg_complete(struct st_data_s *st_gdata, char err)
+static void st_reg_complete(struct st_data_s *st_gdata, int err)
 {
        unsigned char i = 0;
        pr_info(" %s ", __func__);
index f81e500..3fbd18b 100644 (file)
@@ -94,7 +94,7 @@ struct nfcwilink {
        struct nci_dev                  *ndev;
        unsigned long                   flags;
 
-       char                            st_register_cb_status;
+       int                             st_register_cb_status;
        long                            (*st_write) (struct sk_buff *);
 
        struct completion               completed;
@@ -320,7 +320,7 @@ exit:
 }
 
 /* Called by ST when registration is complete */
-static void nfcwilink_register_complete(void *priv_data, char data)
+static void nfcwilink_register_complete(void *priv_data, int data)
 {
        struct nfcwilink *drv = priv_data;
 
index 0a0d568..f229302 100644 (file)
@@ -71,7 +71,7 @@ struct st_proto_s {
        enum proto_type type;
        long (*recv) (void *, struct sk_buff *);
        unsigned char (*match_packet) (const unsigned char *data);
-       void (*reg_complete_cb) (void *, char data);
+       void (*reg_complete_cb) (void *, int data);
        long (*write) (struct sk_buff *skb);
        void *priv_data;