From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2690E10EB53 for ; Fri, 22 Apr 2022 05:58:44 +0000 (UTC) Date: Thu, 21 Apr 2022 22:58:43 -0700 Message-ID: <878rrxek18.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" To: In-Reply-To: <87a6cdekmt.wl-ashutosh.dixit@intel.com> References: <20220421145211.464313-1-priyanka.dandamudi@intel.com> <20220421145211.464313-3-priyanka.dandamudi@intel.com> <87a6cdekmt.wl-ashutosh.dixit@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 2/6] lib/igt_sysfs: Add helpers to iterate over GTs List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: igt-dev@lists.freedesktop.org Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" List-ID: On Thu, 21 Apr 2022 22:45:46 -0700, Dixit, Ashutosh wrote: > > I think these two igt_debug_on()'s should be removed. The issue is the > for_each_sysfs_gt() loops below will send a gt value 1 greater than the > actual number of gt's (at which point this function returns NULL and the > loops exit). And then these igt_debug_on's will fire during the normal > course of operation whereas they are meant to fire only in error. So if we > fix this, this code becomes: > > > + if (!(access(path, F_OK))) ^ This bracket is also unnecessary. > > + return path; > > + else if (!gt) > > + return igt_sysfs_path(device, path, pathlen); > > The rest LGTM, so with that fixed, this is: > > Reviewed-by: Ashutosh Dixit > > > +#define for_each_sysfs_gt_path(i915__, path__, pathlen__) \ > > + for (int gt__ = 0; \ > > + igt_sysfs_gt_path(i915__, gt__, path__, pathlen__) != NULL; \ > > + gt__++) > > + > > +#define for_each_sysfs_gt_dirfd(i915__, dirfd__, gt__) \ > > + for (gt__ = 0; \ > > + (dirfd__ = igt_sysfs_gt_open(i915__, gt__)) != -1; \ > > + close(dirfd__), gt__++)