[igt-dev] [PATCH i-g-t v5 3/4] tests/xe/xe_guc_pc: Change the sysfs paths
Ghimiray, Himal Prasad
himal.prasad.ghimiray at intel.com
Thu Jul 6 04:10:57 UTC 2023
> -----Original Message-----
> From: Dixit, Ashutosh <ashutosh.dixit at intel.com>
> Sent: 06 July 2023 09:22
> To: Ghimiray, Himal Prasad <himal.prasad.ghimiray at intel.com>
> Cc: igt-dev at lists.freedesktop.org; Upadhyay, Tejas
> <tejas.upadhyay at intel.com>; Iddamsetty, Aravind
> <aravind.iddamsetty at intel.com>; Kamil Konieczny
> <kamil.konieczny at linux.intel.com>; Nilawar, Badal
> <badal.nilawar at intel.com>; Tauro, Riana <riana.tauro at intel.com>; Gupta,
> Anshuman <anshuman.gupta at intel.com>
> Subject: Re: [PATCH i-g-t v5 3/4] tests/xe/xe_guc_pc: Change the sysfs paths
>
> On Wed, 05 Jul 2023 20:20:37 -0700, Ghimiray, Himal Prasad wrote:
> >
> > > -----Original Message-----
> > > From: Dixit, Ashutosh <ashutosh.dixit at intel.com>
> > > Sent: 06 July 2023 05:42
> > > To: Ghimiray, Himal Prasad <himal.prasad.ghimiray at intel.com>
> > > Cc: igt-dev at lists.freedesktop.org; Upadhyay, Tejas
> > > <tejas.upadhyay at intel.com>; Iddamsetty, Aravind
> > > <aravind.iddamsetty at intel.com>; Kamil Konieczny
> > > <kamil.konieczny at linux.intel.com>; Nilawar, Badal
> > > <badal.nilawar at intel.com>; Tauro, Riana <riana.tauro at intel.com>;
> > > Gupta, Anshuman <anshuman.gupta at intel.com>
> > > Subject: Re: [PATCH i-g-t v5 3/4] tests/xe/xe_guc_pc: Change the
> > > sysfs paths
> > >
> > > On Wed, 05 Jul 2023 01:52:58 -0700, Himal Prasad Ghimiray wrote:
> > > >
> > > > diff --git a/tests/xe/xe_guc_pc.c b/tests/xe/xe_guc_pc.c index
> > > > 827693eb4..046791d51 100644
> > > > --- a/tests/xe/xe_guc_pc.c
> > > > +++ b/tests/xe/xe_guc_pc.c
> > > > @@ -137,8 +137,13 @@ static int set_freq(int sysfs, int gt_id,
> > > >const char *freq_name, uint32_t freq)
> > > > {
> > > > int ret = -EAGAIN;
> > > > char path[32];
> > > > + char *gt_path;
> > > > +
> > > > + gt_path = xe_gt_sysfs_path(sysfs, gt_id);
> > > > + igt_assert(snprintf(path, sizeof(path), "%s/freq_%s",
> > > > + xe_gt_sysfs_path(sysfs, gt_id), freq_name) <
> > > sizeof(path));
> > >
> > > No need to do this, delete path[], gt_path can directly be passed
> > > igt_sysfs_printf/scanf?
> >
> > Here we are appending the sysfs entry name to the gt_path. Why it is not
> needed ?
>
> Sorry, I misspoke. But gt_path is not needed, you are not using it, you are
> calling xe_gt_sysfs_path twice. Delete gt_path. Or do what you are doing
> below. Do the same thing in both places.
Thanks for the clarification. Will address it next patch.
>
> >
> > >
> > > > + free(gt_path);
> > > >
> > > > - sprintf(path, "device/gt%d/freq_%s", gt_id, freq_name);
> > > > while (ret == -EAGAIN)
> > > > ret = igt_sysfs_printf(sysfs, path, "%u", freq);
> > > > return ret;
> > > > @@ -149,7 +154,12 @@ static uint32_t get_freq(int sysfs, int
> > > >gt_id, const
> > > char *freq_name)
> > > > uint32_t freq;
> > > > int err = -EAGAIN;
> > > > char path[32];
> > > > - sprintf(path, "device/gt%d/freq_%s", gt_id, freq_name);
> > > > + char *gt_path;
> > > > +
> > > > + gt_path = xe_gt_sysfs_path(sysfs, gt_id);
> > > > + igt_assert(snprintf(path, sizeof(path), "%s/freq_%s",
> > > > + gt_path, freq_name) < sizeof(path));
> > > > + free(gt_path);
> > > > while (err == -EAGAIN)
> > > > err = igt_sysfs_scanf(sysfs, path, "%u", &freq);
> > > > return freq;
> > > > --
> > > > 2.25.1
> > > >
More information about the igt-dev
mailing list