mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 14:11:52 +00:00
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
This commit is contained in:
parent
81f5090db8
commit
d55c79ac86
@ -114,8 +114,8 @@ static const struct kernel_param_ops edac_report_ops = {
|
||||
|
||||
module_param_cb(edac_report, &edac_report_ops, &edac_report, 0644);
|
||||
|
||||
unsigned edac_dimm_info_location(struct dimm_info *dimm, char *buf,
|
||||
unsigned len)
|
||||
unsigned int edac_dimm_info_location(struct dimm_info *dimm, char *buf,
|
||||
unsigned int len)
|
||||
{
|
||||
struct mem_ctl_info *mci = dimm->mci;
|
||||
int i, n, count = 0;
|
||||
@ -236,9 +236,9 @@ EXPORT_SYMBOL_GPL(edac_mem_types);
|
||||
* At return, the pointer 'p' will be incremented to be used on a next call
|
||||
* to this function.
|
||||
*/
|
||||
void *edac_align_ptr(void **p, unsigned size, int n_elems)
|
||||
void *edac_align_ptr(void **p, unsigned int size, int n_elems)
|
||||
{
|
||||
unsigned align, r;
|
||||
unsigned int align, r;
|
||||
void *ptr = *p;
|
||||
|
||||
*p += size * n_elems;
|
||||
@ -302,10 +302,10 @@ static void _edac_mc_free(struct mem_ctl_info *mci)
|
||||
kfree(mci);
|
||||
}
|
||||
|
||||
struct mem_ctl_info *edac_mc_alloc(unsigned mc_num,
|
||||
unsigned n_layers,
|
||||
struct mem_ctl_info *edac_mc_alloc(unsigned int mc_num,
|
||||
unsigned int n_layers,
|
||||
struct edac_mc_layer *layers,
|
||||
unsigned sz_pvt)
|
||||
unsigned int sz_pvt)
|
||||
{
|
||||
struct mem_ctl_info *mci;
|
||||
struct edac_mc_layer *layer;
|
||||
@ -313,9 +313,9 @@ struct mem_ctl_info *edac_mc_alloc(unsigned mc_num,
|
||||
struct rank_info *chan;
|
||||
struct dimm_info *dimm;
|
||||
u32 *ce_per_layer[EDAC_MAX_LAYERS], *ue_per_layer[EDAC_MAX_LAYERS];
|
||||
unsigned pos[EDAC_MAX_LAYERS];
|
||||
unsigned size, tot_dimms = 1, count = 1;
|
||||
unsigned tot_csrows = 1, tot_channels = 1, tot_errcount = 0;
|
||||
unsigned int pos[EDAC_MAX_LAYERS];
|
||||
unsigned int size, tot_dimms = 1, count = 1;
|
||||
unsigned int tot_csrows = 1, tot_channels = 1, tot_errcount = 0;
|
||||
void *pvt, *p, *ptr = NULL;
|
||||
int i, j, row, chn, n, len, off;
|
||||
bool per_rank = false;
|
||||
|
@ -122,10 +122,10 @@ do { \
|
||||
* On success, return a pointer to struct mem_ctl_info pointer;
|
||||
* %NULL otherwise
|
||||
*/
|
||||
struct mem_ctl_info *edac_mc_alloc(unsigned mc_num,
|
||||
unsigned n_layers,
|
||||
struct mem_ctl_info *edac_mc_alloc(unsigned int mc_num,
|
||||
unsigned int n_layers,
|
||||
struct edac_mc_layer *layers,
|
||||
unsigned sz_pvt);
|
||||
unsigned int sz_pvt);
|
||||
|
||||
/**
|
||||
* edac_get_owner - Return the owner's mod_name of EDAC MC
|
||||
|
@ -131,7 +131,7 @@ static const char * const edac_caps[] = {
|
||||
|
||||
struct dev_ch_attribute {
|
||||
struct device_attribute attr;
|
||||
int channel;
|
||||
unsigned int channel;
|
||||
};
|
||||
|
||||
#define DEVICE_CHANNEL(_name, _mode, _show, _store, _var) \
|
||||
@ -200,7 +200,7 @@ static ssize_t channel_dimm_label_show(struct device *dev,
|
||||
char *data)
|
||||
{
|
||||
struct csrow_info *csrow = to_csrow(dev);
|
||||
unsigned chan = to_channel(mattr);
|
||||
unsigned int chan = to_channel(mattr);
|
||||
struct rank_info *rank = csrow->channels[chan];
|
||||
|
||||
/* 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,
|
||||
const char *data, size_t count)
|
||||
{
|
||||
struct csrow_info *csrow = to_csrow(dev);
|
||||
unsigned chan = to_channel(mattr);
|
||||
unsigned int chan = to_channel(mattr);
|
||||
struct rank_info *rank = csrow->channels[chan];
|
||||
size_t copy_count = count;
|
||||
|
||||
@ -240,7 +240,7 @@ static ssize_t channel_ce_count_show(struct device *dev,
|
||||
struct device_attribute *mattr, char *data)
|
||||
{
|
||||
struct csrow_info *csrow = to_csrow(dev);
|
||||
unsigned chan = to_channel(mattr);
|
||||
unsigned int chan = to_channel(mattr);
|
||||
struct rank_info *rank = csrow->channels[chan];
|
||||
|
||||
return sprintf(data, "%u\n", rank->ce_count);
|
||||
|
@ -68,7 +68,7 @@ struct memdev_dmi_entry {
|
||||
|
||||
struct ghes_edac_dimm_fill {
|
||||
struct mem_ctl_info *mci;
|
||||
unsigned count;
|
||||
unsigned int count;
|
||||
};
|
||||
|
||||
static void ghes_edac_count_dimms(const struct dmi_header *dh, void *arg)
|
||||
|
@ -417,7 +417,8 @@ static const char *i5100_err_msg(unsigned err)
|
||||
}
|
||||
|
||||
/* convert csrow index into a rank (per channel -- 0..5) */
|
||||
static int i5100_csrow_to_rank(const struct mem_ctl_info *mci, int csrow)
|
||||
static unsigned int i5100_csrow_to_rank(const struct mem_ctl_info *mci,
|
||||
unsigned int csrow)
|
||||
{
|
||||
const struct i5100_priv *priv = mci->pvt_info;
|
||||
|
||||
@ -425,7 +426,8 @@ static int i5100_csrow_to_rank(const struct mem_ctl_info *mci, int csrow)
|
||||
}
|
||||
|
||||
/* convert csrow index into a channel (0..1) */
|
||||
static int i5100_csrow_to_chan(const struct mem_ctl_info *mci, int csrow)
|
||||
static unsigned int i5100_csrow_to_chan(const struct mem_ctl_info *mci,
|
||||
unsigned int csrow)
|
||||
{
|
||||
const struct i5100_priv *priv = mci->pvt_info;
|
||||
|
||||
@ -653,11 +655,11 @@ static struct pci_dev *pci_get_device_func(unsigned vendor,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static unsigned long i5100_npages(struct mem_ctl_info *mci, int csrow)
|
||||
static unsigned long i5100_npages(struct mem_ctl_info *mci, unsigned int csrow)
|
||||
{
|
||||
struct i5100_priv *priv = mci->pvt_info;
|
||||
const unsigned chan_rank = i5100_csrow_to_rank(mci, csrow);
|
||||
const unsigned chan = i5100_csrow_to_chan(mci, csrow);
|
||||
const unsigned int chan_rank = i5100_csrow_to_rank(mci, csrow);
|
||||
const unsigned int chan = i5100_csrow_to_chan(mci, csrow);
|
||||
unsigned addr_lines;
|
||||
|
||||
/* dimm present? */
|
||||
@ -852,8 +854,8 @@ static void i5100_init_csrows(struct mem_ctl_info *mci)
|
||||
for (i = 0; i < mci->tot_dimms; i++) {
|
||||
struct dimm_info *dimm;
|
||||
const unsigned long npages = i5100_npages(mci, i);
|
||||
const unsigned chan = i5100_csrow_to_chan(mci, i);
|
||||
const unsigned rank = i5100_csrow_to_rank(mci, i);
|
||||
const unsigned int chan = i5100_csrow_to_chan(mci, i);
|
||||
const unsigned int rank = i5100_csrow_to_rank(mci, i);
|
||||
|
||||
if (!npages)
|
||||
continue;
|
||||
|
@ -440,7 +440,7 @@ struct dimm_info {
|
||||
char label[EDAC_MC_LABEL_LEN + 1]; /* DIMM label on motherboard */
|
||||
|
||||
/* Memory location data */
|
||||
unsigned location[EDAC_MAX_LAYERS];
|
||||
unsigned int location[EDAC_MAX_LAYERS];
|
||||
|
||||
struct mem_ctl_info *mci; /* the parent */
|
||||
|
||||
@ -451,7 +451,7 @@ struct dimm_info {
|
||||
|
||||
u32 nr_pages; /* number of pages on this dimm */
|
||||
|
||||
unsigned csrow, cschannel; /* Points to the old API data */
|
||||
unsigned int csrow, cschannel; /* Points to the old API data */
|
||||
|
||||
u16 smbios_handle; /* Handle for SMBIOS type 17 */
|
||||
};
|
||||
@ -597,7 +597,7 @@ struct mem_ctl_info {
|
||||
unsigned long page);
|
||||
int mc_idx;
|
||||
struct csrow_info **csrows;
|
||||
unsigned nr_csrows, num_cschannel;
|
||||
unsigned int nr_csrows, num_cschannel;
|
||||
|
||||
/*
|
||||
* Memory Controller hierarchy
|
||||
@ -608,14 +608,14 @@ struct mem_ctl_info {
|
||||
* of the recent drivers enumerate memories per DIMM, instead.
|
||||
* When the memory controller is per rank, csbased is true.
|
||||
*/
|
||||
unsigned n_layers;
|
||||
unsigned int n_layers;
|
||||
struct edac_mc_layer *layers;
|
||||
bool csbased;
|
||||
|
||||
/*
|
||||
* DIMM info. Will eventually remove the entire csrows_info some day
|
||||
*/
|
||||
unsigned tot_dimms;
|
||||
unsigned int tot_dimms;
|
||||
struct dimm_info **dimms;
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user