From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4A95610E4DB for ; Fri, 7 Jul 2023 01:01:27 +0000 (UTC) Date: Thu, 06 Jul 2023 18:01:23 -0700 Message-ID: <87cz14cz6k.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" To: Himal Prasad Ghimiray In-Reply-To: <20230706104500.595707-4-himal.prasad.ghimiray@intel.com> References: <20230706104500.595707-1-himal.prasad.ghimiray@intel.com> <20230706104500.595707-4-himal.prasad.ghimiray@intel.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Subject: Re: [igt-dev] [PATCH i-g-t v7 3/4] tests/xe/xe_guc_pc: Change the sysfs paths List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Upadhyay , igt-dev@lists.freedesktop.org, Badal Nilawar Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" List-ID: On Thu, 06 Jul 2023 03:44:59 -0700, Himal Prasad Ghimiray wrote: > > diff --git a/tests/xe/xe_guc_pc.c b/tests/xe/xe_guc_pc.c > index 827693eb4..d70b08d1e 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", > + gt_path, freq_name) < sizeof(path)); > + 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); After the changes mentioned in Patch 2 the function prototypes will change as mentioned in Patch 2 comments. So we will now call xe_sysfs_gt_open() here and rename path[] to attr[] and then we can do igt_sysfs_scanf/igt_sysfs_printf.