misc: sgi-gru: use explicitly signed char
authorJason A. Donenfeld <Jason@zx2c4.com>
Tue, 25 Oct 2022 02:52:23 +0000 (04:52 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 25 Oct 2022 17:12:10 +0000 (19:12 +0200)
With char becoming unsigned by default, and with `char` alone being
ambiguous and based on architecture, signed chars need to be marked
explicitly as such. This fixes warnings like:

drivers/misc/sgi-gru/grumain.c:711 gru_check_chiplet_assignment() warn: 'gts->ts_user_chiplet_id' is unsigned

Cc: Dimitri Sivanich <dimitri.sivanich@hpe.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Link: https://lore.kernel.org/r/20221025025223.573543-1-Jason@zx2c4.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/sgi-gru/grumain.c
drivers/misc/sgi-gru/grutables.h

index 9afda47..6706ef3 100644 (file)
@@ -152,7 +152,7 @@ static int gru_assign_asid(struct gru_state *gru)
  * Optionally, build an array of chars that contain the bit numbers allocated.
  */
 static unsigned long reserve_resources(unsigned long *p, int n, int mmax,
-                                      char *idx)
+                                      signed char *idx)
 {
        unsigned long bits = 0;
        int i;
@@ -170,14 +170,14 @@ static unsigned long reserve_resources(unsigned long *p, int n, int mmax,
 }
 
 unsigned long gru_reserve_cb_resources(struct gru_state *gru, int cbr_au_count,
-                                      char *cbmap)
+                                      signed char *cbmap)
 {
        return reserve_resources(&gru->gs_cbr_map, cbr_au_count, GRU_CBR_AU,
                                 cbmap);
 }
 
 unsigned long gru_reserve_ds_resources(struct gru_state *gru, int dsr_au_count,
-                                      char *dsmap)
+                                      signed char *dsmap)
 {
        return reserve_resources(&gru->gs_dsr_map, dsr_au_count, GRU_DSR_AU,
                                 dsmap);
index 5efc869..8c52776 100644 (file)
@@ -351,7 +351,7 @@ struct gru_thread_state {
        pid_t                   ts_tgid_owner;  /* task that is using the
                                                   context - for migration */
        short                   ts_user_blade_id;/* user selected blade */
-       char                    ts_user_chiplet_id;/* user selected chiplet */
+       signed char             ts_user_chiplet_id;/* user selected chiplet */
        unsigned short          ts_sizeavail;   /* Pagesizes in use */
        int                     ts_tsid;        /* thread that owns the
                                                   structure */
@@ -364,11 +364,11 @@ struct gru_thread_state {
                                                   required for contest */
        unsigned char           ts_cbr_au_count;/* Number of CBR resources
                                                   required for contest */
-       char                    ts_cch_req_slice;/* CCH packet slice */
-       char                    ts_blade;       /* If >= 0, migrate context if
+       signed char             ts_cch_req_slice;/* CCH packet slice */
+       signed char             ts_blade;       /* If >= 0, migrate context if
                                                   ref from different blade */
-       char                    ts_force_cch_reload;
-       char                    ts_cbr_idx[GRU_CBR_AU];/* CBR numbers of each
+       signed char             ts_force_cch_reload;
+       signed char             ts_cbr_idx[GRU_CBR_AU];/* CBR numbers of each
                                                          allocated CB */
        int                     ts_data_valid;  /* Indicates if ts_gdata has
                                                   valid data */
@@ -643,9 +643,9 @@ extern struct gru_thread_state *gru_alloc_gts(struct vm_area_struct *vma,
                int cbr_au_count, int dsr_au_count,
                unsigned char tlb_preload_count, int options, int tsid);
 extern unsigned long gru_reserve_cb_resources(struct gru_state *gru,
-               int cbr_au_count, char *cbmap);
+               int cbr_au_count, signed char *cbmap);
 extern unsigned long gru_reserve_ds_resources(struct gru_state *gru,
-               int dsr_au_count, char *dsmap);
+               int dsr_au_count, signed char *dsmap);
 extern vm_fault_t gru_fault(struct vm_fault *vmf);
 extern struct gru_mm_struct *gru_register_mmu_notifier(void);
 extern void gru_drop_mmu_notifier(struct gru_mm_struct *gms);