On Tue, Jun 8, 2021 at 5:40 PM Luben Tuikov <luben.tuikov@xxxxxxx> wrote: > > Instead of fixing the spelling in > amdgpu_ras_eeprom_process_recods(), > rename it to, > amdgpu_ras_eeprom_xfer(), > to look similar to other I2C and protocol > transfer (read/write) functions. > > Also to keep the column span to within reason by > using a shorter name. > > Change the "num" function parameter from "int" to > "const u32" since it is the number of items > (records) to xfer, i.e. their count, which cannot > be a negative number. > > Also swap the order of parameters, keeping the > pointer to records and their number next to each > other, while the direction now becomes the last > parameter. > > Cc: Jean Delvare <jdelvare@xxxxxxx> > Cc: Alexander Deucher <Alexander.Deucher@xxxxxxx> > Cc: Andrey Grodzovsky <Andrey.Grodzovsky@xxxxxxx> > Cc: Lijo Lazar <Lijo.Lazar@xxxxxxx> > Cc: Stanley Yang <Stanley.Yang@xxxxxxx> > Cc: Hawking Zhang <Hawking.Zhang@xxxxxxx> > Signed-off-by: Luben Tuikov <luben.tuikov@xxxxxxx> Acked-by: Alex Deucher <alexander.deucher@xxxxxxx> > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 11 +++++------ > drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 10 +++++----- > drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.h | 7 +++---- > 3 files changed, 13 insertions(+), 15 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c > index ec936cde272602..beaa1fee7f71f3 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c > @@ -1817,10 +1817,10 @@ int amdgpu_ras_save_bad_pages(struct amdgpu_device *adev) > save_count = data->count - control->num_recs; > /* only new entries are saved */ > if (save_count > 0) { > - if (amdgpu_ras_eeprom_process_recods(control, > - &data->bps[control->num_recs], > - true, > - save_count)) { > + if (amdgpu_ras_eeprom_xfer(control, > + &data->bps[control->num_recs], > + save_count, > + true)) { > dev_err(adev->dev, "Failed to save EEPROM table data!"); > return -EIO; > } > @@ -1850,8 +1850,7 @@ static int amdgpu_ras_load_bad_pages(struct amdgpu_device *adev) > if (!bps) > return -ENOMEM; > > - if (amdgpu_ras_eeprom_process_recods(control, bps, false, > - control->num_recs)) { > + if (amdgpu_ras_eeprom_xfer(control, bps, control->num_recs, false)) { > dev_err(adev->dev, "Failed to load EEPROM table records!"); > ret = -EIO; > goto out; > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c > index d3678706bb736d..9e3fbc44b4bc4a 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c > @@ -432,9 +432,9 @@ bool amdgpu_ras_eeprom_check_err_threshold(struct amdgpu_device *adev) > return false; > } > > -int amdgpu_ras_eeprom_process_recods(struct amdgpu_ras_eeprom_control *control, > - struct eeprom_table_record *records, > - bool write, int num) > +int amdgpu_ras_eeprom_xfer(struct amdgpu_ras_eeprom_control *control, > + struct eeprom_table_record *records, > + const u32 num, bool write) > { > int i, ret = 0; > unsigned char *buffs, *buff; > @@ -574,13 +574,13 @@ void amdgpu_ras_eeprom_test(struct amdgpu_ras_eeprom_control *control) > recs[i].retired_page = i; > } > > - if (!amdgpu_ras_eeprom_process_recods(control, recs, true, 1)) { > + if (!amdgpu_ras_eeprom_xfer(control, recs, 1, true)) { > > memset(recs, 0, sizeof(*recs) * 1); > > control->next_addr = RAS_RECORD_START; > > - if (!amdgpu_ras_eeprom_process_recods(control, recs, false, 1)) { > + if (!amdgpu_ras_eeprom_xfer(control, recs, 1, false)) { > for (i = 0; i < 1; i++) > DRM_INFO("rec.address :0x%llx, rec.retired_page :%llu", > recs[i].address, recs[i].retired_page); > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.h > index 4c4c3d840a35c5..6a1bd527bce57a 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.h > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.h > @@ -82,10 +82,9 @@ int amdgpu_ras_eeprom_reset_table(struct amdgpu_ras_eeprom_control *control); > > bool amdgpu_ras_eeprom_check_err_threshold(struct amdgpu_device *adev); > > -int amdgpu_ras_eeprom_process_recods(struct amdgpu_ras_eeprom_control *control, > - struct eeprom_table_record *records, > - bool write, > - int num); > +int amdgpu_ras_eeprom_xfer(struct amdgpu_ras_eeprom_control *control, > + struct eeprom_table_record *records, > + const u32 num, bool write); > > inline uint32_t amdgpu_ras_eeprom_get_record_max_length(void); > > -- > 2.32.0 > > _______________________________________________ > amd-gfx mailing list > amd-gfx@xxxxxxxxxxxxxxxxxxxxx > https://lists.freedesktop.org/mailman/listinfo/amd-gfx _______________________________________________ amd-gfx mailing list amd-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/amd-gfx