From: "Modem, Bhanuprakash" <bhanuprakash.modem@intel.com>
To: Kamil Konieczny <kamil.konieczny@linux.intel.com>,
igt-dev@lists.freedesktop.org,
Mauro Carvalho Chehab <mauro.chehab@linux.intel.com>,
ankit.k.nautiyal@intel.com, mchehab@kernel.org,
zbigniew.kempczynski@intel.com, karthik.b.s@intel.com,
swati2.sharma@intel.com
Subject: Re: [igt-dev] [i-g-t 1/6] lib: Interface to close the drm fd
Date: Tue, 16 May 2023 18:47:02 +0530 [thread overview]
Message-ID: <03d5feef-b247-40a0-db40-e956b55255b3@intel.com> (raw)
In-Reply-To: <20230509103058.3jajdqpxvvlqfzi4@kamilkon-desk1>
Hi Kamil,
On Tue-09-05-2023 04:00 pm, Kamil Konieczny wrote:
> Hi Bhanuprakash,
>
> On 2023-05-04 at 10:27:21 +0530, Bhanuprakash Modem wrote:
>> Add new helper drm_close_driver() to close the drm fd. So that
> -------------------------------------------------------- ^^^^^^^
> s/So that/Now/
>
>> every user could call drm_close_driver() instead of close().
>>
>> Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
>> ---
>> lib/drmtest.c | 17 +++++++++++++++++
>> lib/drmtest.h | 1 +
>> 2 files changed, 18 insertions(+)
>>
>> diff --git a/lib/drmtest.c b/lib/drmtest.c
>> index c91a91425..03b5239b2 100644
>> --- a/lib/drmtest.c
>> +++ b/lib/drmtest.c
>> @@ -604,6 +604,23 @@ int drm_open_driver(int chipset)
>> return fd;
>> }
>>
>> +/**
>> + * drm_close_driver:
>> + * @fd: a drm file descriptor
>> + *
>> + * Close the drm file descriptor @fd.
>> + *
>> + * Returns: 0 on success or -1 on error.
>> + */
>> +int drm_close_driver(int fd)
>> +{
>> + /* Avoid closing standard file descriptors (0, 1, and 2). */
>> + if (fd < 3)
>
> -1 is ok here, if you are concerned about 0...2 imho print debug
> message here for these.
Sure, will fix this in next rev.
>
>> + return -1;
>> +
>> + return close(fd);
>> +}
>> +
>> /**
>> * drm_open_driver_master:
>> * @chipset: OR'd flags for each chipset to search, eg. #DRIVER_INTEL
>> diff --git a/lib/drmtest.h b/lib/drmtest.h
>> index 3c88b85c6..2b7ffc765 100644
>> --- a/lib/drmtest.h
>> +++ b/lib/drmtest.h
>> @@ -105,6 +105,7 @@ int drm_open_driver_render(int chipset);
>> int __drm_open_driver_another(int idx, int chipset);
>> int __drm_open_driver(int chipset);
>> int __drm_open_driver_render(int chipset);
>> +int drm_close_driver(int fd);
>
> imho this may be __drm_close_driver(int fd) and drm_close_driver
> could be macro with setting fd to -1 after succesfull close ?
Not understood, why do we need to set fd = -1 ?
- Bhanu
>
> Regards,
> Kamil
>
>>
>> void igt_require_amdgpu(int fd);
>> void igt_require_intel(int fd);
>> --
>> 2.40.0
>>
next prev parent reply other threads:[~2023-05-16 13:17 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-04 4:57 [igt-dev] [i-g-t 0/6] XE test cleanup to handle xe_device Bhanuprakash Modem
2023-05-04 4:57 ` [igt-dev] [i-g-t 1/6] lib: Interface to close the drm fd Bhanuprakash Modem
2023-05-09 7:21 ` Modem, Bhanuprakash
2023-05-09 10:30 ` Kamil Konieczny
2023-05-16 13:17 ` Modem, Bhanuprakash [this message]
2023-05-18 18:35 ` Zbigniew Kempczyński
2023-05-04 4:57 ` [igt-dev] [i-g-t 2/6] lib: Cache xe_device at driver open/close level Bhanuprakash Modem
2023-05-09 7:21 ` Modem, Bhanuprakash
2023-05-09 9:31 ` Kamil Konieczny
2023-05-11 5:30 ` Zbigniew Kempczyński
2023-05-16 13:41 ` Modem, Bhanuprakash
2023-05-04 4:57 ` [igt-dev] [i-g-t 3/6] lib/xe/xe_query: Add xe_config() interface Bhanuprakash Modem
2023-05-09 7:21 ` Modem, Bhanuprakash
2023-05-09 13:31 ` Kamil Konieczny
2023-05-04 4:57 ` [igt-dev] [i-g-t 4/6] Revert "lib/igt_kms: Cache xe_device info for kms tests" Bhanuprakash Modem
2023-05-09 7:22 ` Modem, Bhanuprakash
2023-05-09 13:47 ` Kamil Konieczny
2023-05-04 4:57 ` [igt-dev] [i-g-t 5/6] tests: Use drm_close_driver() to close the drm fd Bhanuprakash Modem
2023-05-04 12:07 ` [igt-dev] [i-g-t V2 " Bhanuprakash Modem
2023-05-09 10:24 ` Kamil Konieczny
2023-05-04 4:57 ` [igt-dev] [i-g-t 6/6] tests: Drop xe_device get/put from test level Bhanuprakash Modem
2023-05-09 7:22 ` Modem, Bhanuprakash
2023-05-09 12:26 ` Kamil Konieczny
2023-05-04 5:38 ` [igt-dev] ✗ Fi.CI.BAT: failure for XE test cleanup to handle xe_device Patchwork
2023-05-04 11:29 ` [igt-dev] ✗ GitLab.Pipeline: warning for XE test cleanup to handle xe_device (rev2) Patchwork
2023-05-04 12:03 ` [igt-dev] ✗ Fi.CI.BAT: failure " Patchwork
2023-05-04 15:36 ` [igt-dev] ✓ Fi.CI.BAT: success for XE test cleanup to handle xe_device (rev3) Patchwork
2023-05-05 4:22 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2023-05-09 5:05 ` [igt-dev] [i-g-t 0/6] XE test cleanup to handle xe_device Modem, Bhanuprakash
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=03d5feef-b247-40a0-db40-e956b55255b3@intel.com \
--to=bhanuprakash.modem@intel.com \
--cc=ankit.k.nautiyal@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=kamil.konieczny@linux.intel.com \
--cc=karthik.b.s@intel.com \
--cc=mauro.chehab@linux.intel.com \
--cc=mchehab@kernel.org \
--cc=swati2.sharma@intel.com \
--cc=zbigniew.kempczynski@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.