public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] igt/sysfs: drop support for passing -1 fd for Intel
@ 2019-01-11  8:57 Jani Nikula
  2019-01-11  9:30 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jani Nikula @ 2019-01-11  8:57 UTC (permalink / raw)
  To: igt-dev; +Cc: Jani Nikula

The rabbit hole goes deep in this case, but I couldn't find any place
where we'd still rely on -1 for Intel. Drop the remaining support to
prevent anyone adding new code using this.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 lib/igt_sysfs.c | 50 +++++++++++++++++++++++--------------------------
 1 file changed, 23 insertions(+), 27 deletions(-)

diff --git a/lib/igt_sysfs.c b/lib/igt_sysfs.c
index cce342a057e3..c57e4ae23c5e 100644
--- a/lib/igt_sysfs.c
+++ b/lib/igt_sysfs.c
@@ -86,7 +86,7 @@ static int writeN(int fd, const char *buf, int len)
 
 /**
  * igt_sysfs_path:
- * @device: fd of the device (or -1 to default to Intel)
+ * @device: fd of the device
  * @path: buffer to fill with the sysfs path to the device
  * @pathlen: length of @path buffer
  * @idx: optional pointer to store the card index of the opened device
@@ -100,33 +100,29 @@ char *igt_sysfs_path(int device, char *path, int pathlen, int *idx)
 {
 	struct stat st;
 
-	if (device != -1 && (fstat(device, &st) || !S_ISCHR(st.st_mode)))
+	if (device < 0)
+		return NULL;
+
+	if (fstat(device, &st) || !S_ISCHR(st.st_mode))
 		return NULL;
 
 	for (int n = 0; n < 16; n++) {
-		int len = snprintf(path, pathlen, "/sys/class/drm/card%d", n);
-		if (device != -1) {
-			FILE *file;
-			int ret, maj, min;
-
-			sprintf(path + len, "/dev");
-			file = fopen(path, "r");
-			if (!file)
-				continue;
-
-			ret = fscanf(file, "%d:%d", &maj, &min);
-			fclose(file);
-
-			if (ret != 2 ||
-			    major(st.st_rdev) != maj ||
-			    minor(st.st_rdev) != min)
-				continue;
-		} else {
-			/* Bleh. Search for intel */
-			sprintf(path + len, "/error");
-			if (stat(path, &st))
-				continue;
-		}
+		int len, ret, maj, min;
+		FILE *file;
+
+		len = snprintf(path, pathlen, "/sys/class/drm/card%d", n);
+
+		sprintf(path + len, "/dev");
+		file = fopen(path, "r");
+		if (!file)
+			continue;
+
+		ret = fscanf(file, "%d:%d", &maj, &min);
+		fclose(file);
+
+		if (ret != 2 || major(st.st_rdev) != maj ||
+		    minor(st.st_rdev) != min)
+			continue;
 
 		path[len] = '\0';
 		if (idx)
@@ -139,7 +135,7 @@ char *igt_sysfs_path(int device, char *path, int pathlen, int *idx)
 
 /**
  * igt_sysfs_open:
- * @device: fd of the device (or -1 to default to Intel)
+ * @device: fd of the device
  * @idx: optional pointer to store the card index of the opened device
  *
  * This opens the sysfs directory corresponding to device for use
@@ -160,7 +156,7 @@ int igt_sysfs_open(int device, int *idx)
 
 /**
  * igt_sysfs_set_parameters:
- * @device: fd of the device (or -1 to default to Intel)
+ * @device: fd of the device
  * @parameter: the name of the parameter to set
  * @fmt: printf-esque format string
  *
-- 
2.20.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [igt-dev] ✓ Fi.CI.BAT: success for igt/sysfs: drop support for passing -1 fd for Intel
  2019-01-11  8:57 [igt-dev] [PATCH i-g-t] igt/sysfs: drop support for passing -1 fd for Intel Jani Nikula
@ 2019-01-11  9:30 ` Patchwork
  2019-01-11 15:15 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  2019-01-14  9:27 ` [igt-dev] [PATCH i-g-t] " Jani Nikula
  2 siblings, 0 replies; 4+ messages in thread
From: Patchwork @ 2019-01-11  9:30 UTC (permalink / raw)
  To: Jani Nikula; +Cc: igt-dev

== Series Details ==

Series: igt/sysfs: drop support for passing -1 fd for Intel
URL   : https://patchwork.freedesktop.org/series/55043/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5402 -> IGTPW_2217
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/55043/revisions/1/mbox/

Known issues
------------

  Here are the changes found in IGTPW_2217 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@i915_module_load@reload:
    - fi-blb-e6850:       PASS -> INCOMPLETE [fdo#107718]

  
#### Possible fixes ####

  * igt@kms_chamelium@hdmi-hpd-fast:
    - fi-kbl-7500u:       FAIL [fdo#108767] -> PASS

  
  [fdo#107718]: https://bugs.freedesktop.org/show_bug.cgi?id=107718
  [fdo#108767]: https://bugs.freedesktop.org/show_bug.cgi?id=108767


Participating hosts (42 -> 41)
------------------------------

  Additional (4): fi-hsw-peppy fi-apl-guc fi-snb-2520m fi-pnv-d510 
  Missing    (5): fi-kbl-soraka fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-byt-clapper 


Build changes
-------------

    * IGT: IGT_4759 -> IGTPW_2217

  CI_DRM_5402: bfde6b780f9b2a5ee0dc3535917c42d1e5234a3f @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_2217: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2217/
  IGT_4759: 478452fece3997dfacaa4d6babe6b8bf6fef784f @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2217/
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [igt-dev] ✓ Fi.CI.IGT: success for igt/sysfs: drop support for passing -1 fd for Intel
  2019-01-11  8:57 [igt-dev] [PATCH i-g-t] igt/sysfs: drop support for passing -1 fd for Intel Jani Nikula
  2019-01-11  9:30 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
@ 2019-01-11 15:15 ` Patchwork
  2019-01-14  9:27 ` [igt-dev] [PATCH i-g-t] " Jani Nikula
  2 siblings, 0 replies; 4+ messages in thread
From: Patchwork @ 2019-01-11 15:15 UTC (permalink / raw)
  To: Jani Nikula; +Cc: igt-dev

== Series Details ==

Series: igt/sysfs: drop support for passing -1 fd for Intel
URL   : https://patchwork.freedesktop.org/series/55043/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5402_full -> IGTPW_2217_full
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/55043/revisions/1/mbox/

Known issues
------------

  Here are the changes found in IGTPW_2217_full that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@kms_available_modes_crc@available_mode_test_crc:
    - shard-apl:          PASS -> FAIL [fdo#106641]

  * igt@kms_busy@extended-modeset-hang-newfb-render-a:
    - shard-hsw:          PASS -> DMESG-WARN [fdo#107956]

  * igt@kms_ccs@pipe-b-crc-sprite-planes-basic:
    - shard-glk:          NOTRUN -> FAIL [fdo#108145] +1

  * igt@kms_cursor_crc@cursor-256x256-dpms:
    - shard-glk:          PASS -> FAIL [fdo#103232] +6

  * igt@kms_cursor_crc@cursor-256x256-random:
    - shard-apl:          PASS -> FAIL [fdo#103232] +5

  * igt@kms_cursor_crc@cursor-256x85-sliding:
    - shard-kbl:          PASS -> FAIL [fdo#103232] +1

  * igt@kms_cursor_legacy@all-pipes-torture-bo:
    - shard-kbl:          PASS -> DMESG-WARN [fdo#107122]

  * igt@kms_flip@busy-flip:
    - shard-apl:          PASS -> INCOMPLETE [fdo#103927]

  * igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-blt:
    - shard-glk:          NOTRUN -> FAIL [fdo#103167]

  * igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-pwrite:
    - shard-apl:          PASS -> FAIL [fdo#103167] +1

  * igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-move:
    - shard-kbl:          PASS -> FAIL [fdo#103167] +1

  * igt@kms_frontbuffer_tracking@fbc-2p-primscrn-spr-indfb-onoff:
    - shard-glk:          PASS -> FAIL [fdo#103167] +9

  * igt@kms_plane_multiple@atomic-pipe-b-tiling-y:
    - shard-glk:          PASS -> FAIL [fdo#103166] +7
    - shard-apl:          PASS -> FAIL [fdo#103166] +2
    - shard-kbl:          PASS -> FAIL [fdo#103166] +1

  * igt@kms_rotation_crc@multiplane-rotation-cropping-top:
    - shard-glk:          PASS -> DMESG-WARN [fdo#105763] / [fdo#106538]

  * igt@kms_vblank@pipe-b-ts-continuation-suspend:
    - shard-snb:          PASS -> DMESG-WARN [fdo#102365]

  
#### Possible fixes ####

  * igt@gem_flink_basic@bad-flink:
    - shard-snb:          INCOMPLETE [fdo#105411] -> PASS

  * igt@kms_color@pipe-b-degamma:
    - shard-kbl:          FAIL [fdo#104782] -> PASS
    - shard-apl:          FAIL [fdo#104782] -> PASS

  * igt@kms_cursor_crc@cursor-128x128-random:
    - shard-apl:          FAIL [fdo#103232] -> PASS
    - shard-glk:          FAIL [fdo#103232] -> PASS

  * igt@kms_cursor_crc@cursor-64x64-suspend:
    - shard-apl:          FAIL [fdo#103191] / [fdo#103232] -> PASS

  * igt@kms_cursor_legacy@2x-cursor-vs-flip-legacy:
    - shard-hsw:          FAIL [fdo#105767] -> PASS

  * igt@kms_flip@2x-flip-vs-modeset-vs-hang-interruptible:
    - shard-glk:          INCOMPLETE [fdo#103359] / [k.org#198133] -> PASS

  * igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-blt:
    - shard-glk:          FAIL [fdo#103167] -> PASS

  * igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-onoff:
    - shard-apl:          FAIL [fdo#103167] -> PASS
    - shard-kbl:          FAIL [fdo#103167] -> PASS +1

  * igt@kms_plane_alpha_blend@pipe-a-constant-alpha-max:
    - shard-glk:          FAIL [fdo#108145] -> PASS

  * igt@kms_plane_multiple@atomic-pipe-c-tiling-yf:
    - shard-apl:          FAIL [fdo#103166] -> PASS +1
    - shard-kbl:          FAIL [fdo#103166] -> PASS
    - shard-glk:          FAIL [fdo#103166] -> PASS

  * igt@kms_rotation_crc@multiplane-rotation-cropping-top:
    - shard-kbl:          DMESG-WARN [fdo#105604] -> PASS

  * igt@kms_setmode@basic:
    - shard-apl:          FAIL [fdo#99912] -> PASS

  * igt@pm_rps@waitboost:
    - shard-apl:          FAIL [fdo#102250] -> PASS

  
#### Warnings ####

  * igt@i915_suspend@shrink:
    - shard-kbl:          DMESG-WARN [fdo#109244] -> INCOMPLETE [fdo#103665] / [fdo#106886]
    - shard-snb:          DMESG-WARN [fdo#109244] -> INCOMPLETE [fdo#105411] / [fdo#106886]

  
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  [fdo#102250]: https://bugs.freedesktop.org/show_bug.cgi?id=102250
  [fdo#102365]: https://bugs.freedesktop.org/show_bug.cgi?id=102365
  [fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166
  [fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
  [fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
  [fdo#103232]: https://bugs.freedesktop.org/show_bug.cgi?id=103232
  [fdo#103359]: https://bugs.freedesktop.org/show_bug.cgi?id=103359
  [fdo#103665]: https://bugs.freedesktop.org/show_bug.cgi?id=103665
  [fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
  [fdo#104782]: https://bugs.freedesktop.org/show_bug.cgi?id=104782
  [fdo#105411]: https://bugs.freedesktop.org/show_bug.cgi?id=105411
  [fdo#105604]: https://bugs.freedesktop.org/show_bug.cgi?id=105604
  [fdo#105763]: https://bugs.freedesktop.org/show_bug.cgi?id=105763
  [fdo#105767]: https://bugs.freedesktop.org/show_bug.cgi?id=105767
  [fdo#106538]: https://bugs.freedesktop.org/show_bug.cgi?id=106538
  [fdo#106641]: https://bugs.freedesktop.org/show_bug.cgi?id=106641
  [fdo#106886]: https://bugs.freedesktop.org/show_bug.cgi?id=106886
  [fdo#107122]: https://bugs.freedesktop.org/show_bug.cgi?id=107122
  [fdo#107956]: https://bugs.freedesktop.org/show_bug.cgi?id=107956
  [fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
  [fdo#109244]: https://bugs.freedesktop.org/show_bug.cgi?id=109244
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
  [fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912
  [k.org#198133]: https://bugzilla.kernel.org/show_bug.cgi?id=198133


Participating hosts (6 -> 5)
------------------------------

  Missing    (1): shard-skl 


Build changes
-------------

    * IGT: IGT_4759 -> IGTPW_2217
    * Piglit: piglit_4509 -> None

  CI_DRM_5402: bfde6b780f9b2a5ee0dc3535917c42d1e5234a3f @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_2217: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2217/
  IGT_4759: 478452fece3997dfacaa4d6babe6b8bf6fef784f @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2217/
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [igt-dev] [PATCH i-g-t] igt/sysfs: drop support for passing -1 fd for Intel
  2019-01-11  8:57 [igt-dev] [PATCH i-g-t] igt/sysfs: drop support for passing -1 fd for Intel Jani Nikula
  2019-01-11  9:30 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
  2019-01-11 15:15 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
@ 2019-01-14  9:27 ` Jani Nikula
  2 siblings, 0 replies; 4+ messages in thread
From: Jani Nikula @ 2019-01-14  9:27 UTC (permalink / raw)
  To: igt-dev

On Fri, 11 Jan 2019, Jani Nikula <jani.nikula@intel.com> wrote:
> The rabbit hole goes deep in this case, but I couldn't find any place
> where we'd still rely on -1 for Intel. Drop the remaining support to
> prevent anyone adding new code using this.
>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Pushed with Chris' irc r-b.

BR,
Jani.


> ---
>  lib/igt_sysfs.c | 50 +++++++++++++++++++++++--------------------------
>  1 file changed, 23 insertions(+), 27 deletions(-)
>
> diff --git a/lib/igt_sysfs.c b/lib/igt_sysfs.c
> index cce342a057e3..c57e4ae23c5e 100644
> --- a/lib/igt_sysfs.c
> +++ b/lib/igt_sysfs.c
> @@ -86,7 +86,7 @@ static int writeN(int fd, const char *buf, int len)
>  
>  /**
>   * igt_sysfs_path:
> - * @device: fd of the device (or -1 to default to Intel)
> + * @device: fd of the device
>   * @path: buffer to fill with the sysfs path to the device
>   * @pathlen: length of @path buffer
>   * @idx: optional pointer to store the card index of the opened device
> @@ -100,33 +100,29 @@ char *igt_sysfs_path(int device, char *path, int pathlen, int *idx)
>  {
>  	struct stat st;
>  
> -	if (device != -1 && (fstat(device, &st) || !S_ISCHR(st.st_mode)))
> +	if (device < 0)
> +		return NULL;
> +
> +	if (fstat(device, &st) || !S_ISCHR(st.st_mode))
>  		return NULL;
>  
>  	for (int n = 0; n < 16; n++) {
> -		int len = snprintf(path, pathlen, "/sys/class/drm/card%d", n);
> -		if (device != -1) {
> -			FILE *file;
> -			int ret, maj, min;
> -
> -			sprintf(path + len, "/dev");
> -			file = fopen(path, "r");
> -			if (!file)
> -				continue;
> -
> -			ret = fscanf(file, "%d:%d", &maj, &min);
> -			fclose(file);
> -
> -			if (ret != 2 ||
> -			    major(st.st_rdev) != maj ||
> -			    minor(st.st_rdev) != min)
> -				continue;
> -		} else {
> -			/* Bleh. Search for intel */
> -			sprintf(path + len, "/error");
> -			if (stat(path, &st))
> -				continue;
> -		}
> +		int len, ret, maj, min;
> +		FILE *file;
> +
> +		len = snprintf(path, pathlen, "/sys/class/drm/card%d", n);
> +
> +		sprintf(path + len, "/dev");
> +		file = fopen(path, "r");
> +		if (!file)
> +			continue;
> +
> +		ret = fscanf(file, "%d:%d", &maj, &min);
> +		fclose(file);
> +
> +		if (ret != 2 || major(st.st_rdev) != maj ||
> +		    minor(st.st_rdev) != min)
> +			continue;
>  
>  		path[len] = '\0';
>  		if (idx)
> @@ -139,7 +135,7 @@ char *igt_sysfs_path(int device, char *path, int pathlen, int *idx)
>  
>  /**
>   * igt_sysfs_open:
> - * @device: fd of the device (or -1 to default to Intel)
> + * @device: fd of the device
>   * @idx: optional pointer to store the card index of the opened device
>   *
>   * This opens the sysfs directory corresponding to device for use
> @@ -160,7 +156,7 @@ int igt_sysfs_open(int device, int *idx)
>  
>  /**
>   * igt_sysfs_set_parameters:
> - * @device: fd of the device (or -1 to default to Intel)
> + * @device: fd of the device
>   * @parameter: the name of the parameter to set
>   * @fmt: printf-esque format string
>   *

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-01-14  9:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-11  8:57 [igt-dev] [PATCH i-g-t] igt/sysfs: drop support for passing -1 fd for Intel Jani Nikula
2019-01-11  9:30 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2019-01-11 15:15 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-01-14  9:27 ` [igt-dev] [PATCH i-g-t] " Jani Nikula

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox