summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Richter <rrichter@marvell.com>2019-09-02 08:33:41 -0400
committerBorislav Petkov <bp@suse.de>2019-09-03 13:21:19 -0400
commitd55c79ac86f78fce3c224bda2b383edf96bb6438 (patch)
treeb9b7f7606b4e999d0f5e491233bd5681b520b7a8
parent81f5090db843be897414418c24fe472fa6e082b6 (diff)
EDAC: Prefer 'unsigned int' to bare use of 'unsigned'
Use of 'unsigned int' instead of bare use of 'unsigned'. Fix this for edac_mc*, ghes and the i5100 driver as reported by checkpatch.pl. While at it, struct member dev_ch_attribute->channel is always used as unsigned int. Change type to unsigned int to avoid type casts. [ bp: Massage. ] Signed-off-by: Robert Richter <rrichter@marvell.com> Signed-off-by: Borislav Petkov <bp@suse.de> Reviewed-by: Mauro Carvalho Chehab <mchehab@kernel.org> Cc: "linux-edac@vger.kernel.org" <linux-edac@vger.kernel.org> Cc: James Morse <james.morse@arm.com> Cc: Tony Luck <tony.luck@intel.com> Link: https://lkml.kernel.org/r/20190902123216.9809-2-rrichter@marvell.com
-rw-r--r--drivers/edac/edac_mc.c20
-rw-r--r--drivers/edac/edac_mc.h6
-rw-r--r--drivers/edac/edac_mc_sysfs.c8
-rw-r--r--drivers/edac/ghes_edac.c2
-rw-r--r--drivers/edac/i5100_edac.c16
-rw-r--r--include/linux/edac.h10
6 files changed, 32 insertions, 30 deletions
diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c
index c68f62ab54b0..e6fd079783bd 100644
--- a/drivers/edac/edac_mc.c
+++ b/drivers/edac/edac_mc.c
@@ -114,8 +114,8 @@ static const struct kernel_param_ops edac_report_ops = {
114 114
115module_param_cb(edac_report, &edac_report_ops, &edac_report, 0644); 115module_param_cb(edac_report, &edac_report_ops, &edac_report, 0644);
116 116
117unsigned edac_dimm_info_location(struct dimm_info *dimm, char *buf, 117unsigned int edac_dimm_info_location(struct dimm_info *dimm, char *buf,
118 unsigned len) 118 unsigned int len)
119{ 119{
120 struct mem_ctl_info *mci = dimm->mci; 120 struct mem_ctl_info *mci = dimm->mci;
121 int i, n, count = 0; 121 int i, n, count = 0;
@@ -236,9 +236,9 @@ EXPORT_SYMBOL_GPL(edac_mem_types);
236 * At return, the pointer 'p' will be incremented to be used on a next call 236 * At return, the pointer 'p' will be incremented to be used on a next call
237 * to this function. 237 * to this function.
238 */ 238 */
239void *edac_align_ptr(void **p, unsigned size, int n_elems) 239void *edac_align_ptr(void **p, unsigned int size, int n_elems)
240{ 240{
241 unsigned align, r; 241 unsigned int align, r;
242 void *ptr = *p; 242 void *ptr = *p;
243 243
244 *p += size * n_elems; 244 *p += size * n_elems;
@@ -302,10 +302,10 @@ static void _edac_mc_free(struct mem_ctl_info *mci)
302 kfree(mci); 302 kfree(mci);
303} 303}
304 304
305struct mem_ctl_info *edac_mc_alloc(unsigned mc_num, 305struct mem_ctl_info *edac_mc_alloc(unsigned int mc_num,
306 unsigned n_layers, 306 unsigned int n_layers,
307 struct edac_mc_layer *layers, 307 struct edac_mc_layer *layers,
308 unsigned sz_pvt) 308 unsigned int sz_pvt)
309{ 309{
310 struct mem_ctl_info *mci; 310 struct mem_ctl_info *mci;
311 struct edac_mc_layer *layer; 311 struct edac_mc_layer *layer;
@@ -313,9 +313,9 @@ struct mem_ctl_info *edac_mc_alloc(unsigned mc_num,
313 struct rank_info *chan; 313 struct rank_info *chan;
314 struct dimm_info *dimm; 314 struct dimm_info *dimm;
315 u32 *ce_per_layer[EDAC_MAX_LAYERS], *ue_per_layer[EDAC_MAX_LAYERS]; 315 u32 *ce_per_layer[EDAC_MAX_LAYERS], *ue_per_layer[EDAC_MAX_LAYERS];
316 unsigned pos[EDAC_MAX_LAYERS]; 316 unsigned int pos[EDAC_MAX_LAYERS];
317 unsigned size, tot_dimms = 1, count = 1; 317 unsigned int size, tot_dimms = 1, count = 1;
318 unsigned tot_csrows = 1, tot_channels = 1, tot_errcount = 0; 318 unsigned int tot_csrows = 1, tot_channels = 1, tot_errcount = 0;
319 void *pvt, *p, *ptr = NULL; 319 void *pvt, *p, *ptr = NULL;
320 int i, j, row, chn, n, len, off; 320 int i, j, row, chn, n, len, off;
321 bool per_rank = false; 321 bool per_rank = false;
diff --git a/drivers/edac/edac_mc.h b/drivers/edac/edac_mc.h
index 4165e15995ad..02aac5c61d00 100644
--- a/drivers/edac/edac_mc.h
+++ b/drivers/edac/edac_mc.h
@@ -122,10 +122,10 @@ do { \
122 * On success, return a pointer to struct mem_ctl_info pointer; 122 * On success, return a pointer to struct mem_ctl_info pointer;
123 * %NULL otherwise 123 * %NULL otherwise
124 */ 124 */
125struct mem_ctl_info *edac_mc_alloc(unsigned mc_num, 125struct mem_ctl_info *edac_mc_alloc(unsigned int mc_num,
126 unsigned n_layers, 126 unsigned int n_layers,
127 struct edac_mc_layer *layers, 127 struct edac_mc_layer *layers,
128 unsigned sz_pvt); 128 unsigned int sz_pvt);
129 129
130/** 130/**
131 * edac_get_owner - Return the owner's mod_name of EDAC MC 131 * edac_get_owner - Return the owner's mod_name of EDAC MC
diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c
index 4386ea4b9b5a..4eb8c5ceb973 100644
--- a/drivers/edac/edac_mc_sysfs.c
+++ b/drivers/edac/edac_mc_sysfs.c
@@ -131,7 +131,7 @@ static const char * const edac_caps[] = {
131 131
132struct dev_ch_attribute { 132struct dev_ch_attribute {
133 struct device_attribute attr; 133 struct device_attribute attr;
134 int channel; 134 unsigned int channel;
135}; 135};
136 136
137#define DEVICE_CHANNEL(_name, _mode, _show, _store, _var) \ 137#define DEVICE_CHANNEL(_name, _mode, _show, _store, _var) \
@@ -200,7 +200,7 @@ static ssize_t channel_dimm_label_show(struct device *dev,
200 char *data) 200 char *data)
201{ 201{
202 struct csrow_info *csrow = to_csrow(dev); 202 struct csrow_info *csrow = to_csrow(dev);
203 unsigned chan = to_channel(mattr); 203 unsigned int chan = to_channel(mattr);
204 struct rank_info *rank = csrow->channels[chan]; 204 struct rank_info *rank = csrow->channels[chan];
205 205
206 /* if field has not been initialized, there is nothing to send */ 206 /* if field has not been initialized, there is nothing to send */
@@ -216,7 +216,7 @@ static ssize_t channel_dimm_label_store(struct device *dev,
216 const char *data, size_t count) 216 const char *data, size_t count)
217{ 217{
218 struct csrow_info *csrow = to_csrow(dev); 218 struct csrow_info *csrow = to_csrow(dev);
219 unsigned chan = to_channel(mattr); 219 unsigned int chan = to_channel(mattr);
220 struct rank_info *rank = csrow->channels[chan]; 220 struct rank_info *rank = csrow->channels[chan];
221 size_t copy_count = count; 221 size_t copy_count = count;
222 222
@@ -240,7 +240,7 @@ static ssize_t channel_ce_count_show(struct device *dev,
240 struct device_attribute *mattr, char *data) 240 struct device_attribute *mattr, char *data)
241{ 241{
242 struct csrow_info *csrow = to_csrow(dev); 242 struct csrow_info *csrow = to_csrow(dev);
243 unsigned chan = to_channel(mattr); 243 unsigned int chan = to_channel(mattr);
244 struct rank_info *rank = csrow->channels[chan]; 244 struct rank_info *rank = csrow->channels[chan];
245 245
246 return sprintf(data, "%u\n", rank->ce_count); 246 return sprintf(data, "%u\n", rank->ce_count);
diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c
index 7f19f1c672c3..d413a0bdc9ad 100644
--- a/drivers/edac/ghes_edac.c
+++ b/drivers/edac/ghes_edac.c
@@ -68,7 +68,7 @@ struct memdev_dmi_entry {
68 68
69struct ghes_edac_dimm_fill { 69struct ghes_edac_dimm_fill {
70 struct mem_ctl_info *mci; 70 struct mem_ctl_info *mci;
71 unsigned count; 71 unsigned int count;
72}; 72};
73 73
74static void ghes_edac_count_dimms(const struct dmi_header *dh, void *arg) 74static void ghes_edac_count_dimms(const struct dmi_header *dh, void *arg)
diff --git a/drivers/edac/i5100_edac.c b/drivers/edac/i5100_edac.c
index b506eef6b146..251f2b692785 100644
--- a/drivers/edac/i5100_edac.c
+++ b/drivers/edac/i5100_edac.c
@@ -417,7 +417,8 @@ static const char *i5100_err_msg(unsigned err)
417} 417}
418 418
419/* convert csrow index into a rank (per channel -- 0..5) */ 419/* convert csrow index into a rank (per channel -- 0..5) */
420static int i5100_csrow_to_rank(const struct mem_ctl_info *mci, int csrow) 420static unsigned int i5100_csrow_to_rank(const struct mem_ctl_info *mci,
421 unsigned int csrow)
421{ 422{
422 const struct i5100_priv *priv = mci->pvt_info; 423 const struct i5100_priv *priv = mci->pvt_info;
423 424
@@ -425,7 +426,8 @@ static int i5100_csrow_to_rank(const struct mem_ctl_info *mci, int csrow)
425} 426}
426 427
427/* convert csrow index into a channel (0..1) */ 428/* convert csrow index into a channel (0..1) */
428static int i5100_csrow_to_chan(const struct mem_ctl_info *mci, int csrow) 429static unsigned int i5100_csrow_to_chan(const struct mem_ctl_info *mci,
430 unsigned int csrow)
429{ 431{
430 const struct i5100_priv *priv = mci->pvt_info; 432 const struct i5100_priv *priv = mci->pvt_info;
431 433
@@ -653,11 +655,11 @@ static struct pci_dev *pci_get_device_func(unsigned vendor,
653 return ret; 655 return ret;
654} 656}
655 657
656static unsigned long i5100_npages(struct mem_ctl_info *mci, int csrow) 658static unsigned long i5100_npages(struct mem_ctl_info *mci, unsigned int csrow)
657{ 659{
658 struct i5100_priv *priv = mci->pvt_info; 660 struct i5100_priv *priv = mci->pvt_info;
659 const unsigned chan_rank = i5100_csrow_to_rank(mci, csrow); 661 const unsigned int chan_rank = i5100_csrow_to_rank(mci, csrow);
660 const unsigned chan = i5100_csrow_to_chan(mci, csrow); 662 const unsigned int chan = i5100_csrow_to_chan(mci, csrow);
661 unsigned addr_lines; 663 unsigned addr_lines;
662 664
663 /* dimm present? */ 665 /* dimm present? */
@@ -852,8 +854,8 @@ static void i5100_init_csrows(struct mem_ctl_info *mci)
852 for (i = 0; i < mci->tot_dimms; i++) { 854 for (i = 0; i < mci->tot_dimms; i++) {
853 struct dimm_info *dimm; 855 struct dimm_info *dimm;
854 const unsigned long npages = i5100_npages(mci, i); 856 const unsigned long npages = i5100_npages(mci, i);
855 const unsigned chan = i5100_csrow_to_chan(mci, i); 857 const unsigned int chan = i5100_csrow_to_chan(mci, i);
856 const unsigned rank = i5100_csrow_to_rank(mci, i); 858 const unsigned int rank = i5100_csrow_to_rank(mci, i);
857 859
858 if (!npages) 860 if (!npages)
859 continue; 861 continue;
diff --git a/include/linux/edac.h b/include/linux/edac.h
index 342dabda9c7e..c19483b90079 100644
--- a/include/linux/edac.h
+++ b/include/linux/edac.h
@@ -440,7 +440,7 @@ struct dimm_info {
440 char label[EDAC_MC_LABEL_LEN + 1]; /* DIMM label on motherboard */ 440 char label[EDAC_MC_LABEL_LEN + 1]; /* DIMM label on motherboard */
441 441
442 /* Memory location data */ 442 /* Memory location data */
443 unsigned location[EDAC_MAX_LAYERS]; 443 unsigned int location[EDAC_MAX_LAYERS];
444 444
445 struct mem_ctl_info *mci; /* the parent */ 445 struct mem_ctl_info *mci; /* the parent */
446 446
@@ -451,7 +451,7 @@ struct dimm_info {
451 451
452 u32 nr_pages; /* number of pages on this dimm */ 452 u32 nr_pages; /* number of pages on this dimm */
453 453
454 unsigned csrow, cschannel; /* Points to the old API data */ 454 unsigned int csrow, cschannel; /* Points to the old API data */
455 455
456 u16 smbios_handle; /* Handle for SMBIOS type 17 */ 456 u16 smbios_handle; /* Handle for SMBIOS type 17 */
457}; 457};
@@ -597,7 +597,7 @@ struct mem_ctl_info {
597 unsigned long page); 597 unsigned long page);
598 int mc_idx; 598 int mc_idx;
599 struct csrow_info **csrows; 599 struct csrow_info **csrows;
600 unsigned nr_csrows, num_cschannel; 600 unsigned int nr_csrows, num_cschannel;
601 601
602 /* 602 /*
603 * Memory Controller hierarchy 603 * Memory Controller hierarchy
@@ -608,14 +608,14 @@ struct mem_ctl_info {
608 * of the recent drivers enumerate memories per DIMM, instead. 608 * of the recent drivers enumerate memories per DIMM, instead.
609 * When the memory controller is per rank, csbased is true. 609 * When the memory controller is per rank, csbased is true.
610 */ 610 */
611 unsigned n_layers; 611 unsigned int n_layers;
612 struct edac_mc_layer *layers; 612 struct edac_mc_layer *layers;
613 bool csbased; 613 bool csbased;
614 614
615 /* 615 /*
616 * DIMM info. Will eventually remove the entire csrows_info some day 616 * DIMM info. Will eventually remove the entire csrows_info some day
617 */ 617 */
618 unsigned tot_dimms; 618 unsigned int tot_dimms;
619 struct dimm_info **dimms; 619 struct dimm_info **dimms;
620 620
621 /* 621 /*