misc: sgi-gru: use explicitly signed char
Commit Message
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>
---
drivers/misc/sgi-gru/grumain.c | 6 +++---
drivers/misc/sgi-gru/grutables.h | 10 +++++-----
2 files changed, 8 insertions(+), 8 deletions(-)
Comments
Hi Jason,
I love your patch! Yet something to improve:
[auto build test ERROR on char-misc/char-misc-testing]
[also build test ERROR on crng-random/master soc/for-next linus/master v6.1-rc2 next-20221024]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Jason-A-Donenfeld/misc-sgi-gru-use-explicitly-signed-char/20221025-031949
patch link: https://lore.kernel.org/r/20221024162823.535884-1-Jason%40zx2c4.com
patch subject: [PATCH] misc: sgi-gru: use explicitly signed char
config: x86_64-rhel-8.3-kunit
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/98004b57afa345d7719be46c894cc07e7731df11
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Jason-A-Donenfeld/misc-sgi-gru-use-explicitly-signed-char/20221025-031949
git checkout 98004b57afa345d7719be46c894cc07e7731df11
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/misc/sgi-gru/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
>> drivers/misc/sgi-gru/grumain.c:172:15: error: conflicting types for 'gru_reserve_cb_resources'; have 'long unsigned int(struct gru_state *, int, signed char *)'
172 | unsigned long gru_reserve_cb_resources(struct gru_state *gru, int cbr_au_count,
| ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from drivers/misc/sgi-gru/grumain.c:21:
drivers/misc/sgi-gru/grutables.h:645:22: note: previous declaration of 'gru_reserve_cb_resources' with type 'long unsigned int(struct gru_state *, int, char *)'
645 | extern unsigned long gru_reserve_cb_resources(struct gru_state *gru,
| ^~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/misc/sgi-gru/grumain.c:179:15: error: conflicting types for 'gru_reserve_ds_resources'; have 'long unsigned int(struct gru_state *, int, signed char *)'
179 | unsigned long gru_reserve_ds_resources(struct gru_state *gru, int dsr_au_count,
| ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from drivers/misc/sgi-gru/grumain.c:21:
drivers/misc/sgi-gru/grutables.h:647:22: note: previous declaration of 'gru_reserve_ds_resources' with type 'long unsigned int(struct gru_state *, int, char *)'
647 | extern unsigned long gru_reserve_ds_resources(struct gru_state *gru,
| ^~~~~~~~~~~~~~~~~~~~~~~~
vim +172 drivers/misc/sgi-gru/grumain.c
9a0deecc90de62 Jack Steiner 2008-07-29 171
9ca8e40c130c90 Jack Steiner 2008-07-29 @172 unsigned long gru_reserve_cb_resources(struct gru_state *gru, int cbr_au_count,
98004b57afa345 Jason A. Donenfeld 2022-10-24 173 signed char *cbmap)
9a0deecc90de62 Jack Steiner 2008-07-29 174 {
9a0deecc90de62 Jack Steiner 2008-07-29 175 return reserve_resources(&gru->gs_cbr_map, cbr_au_count, GRU_CBR_AU,
9a0deecc90de62 Jack Steiner 2008-07-29 176 cbmap);
9a0deecc90de62 Jack Steiner 2008-07-29 177 }
9a0deecc90de62 Jack Steiner 2008-07-29 178
9ca8e40c130c90 Jack Steiner 2008-07-29 @179 unsigned long gru_reserve_ds_resources(struct gru_state *gru, int dsr_au_count,
98004b57afa345 Jason A. Donenfeld 2022-10-24 180 signed char *dsmap)
9a0deecc90de62 Jack Steiner 2008-07-29 181 {
9a0deecc90de62 Jack Steiner 2008-07-29 182 return reserve_resources(&gru->gs_dsr_map, dsr_au_count, GRU_DSR_AU,
9a0deecc90de62 Jack Steiner 2008-07-29 183 dsmap);
9a0deecc90de62 Jack Steiner 2008-07-29 184 }
9a0deecc90de62 Jack Steiner 2008-07-29 185
@@ -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);
@@ -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 */