intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Jani Nikula <jani.nikula@intel.com>, intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH 2/2] drm/i915/uncore: rename i915_reg_read_ioctl intel_uncore_reg_read_ioctl
Date: Wed, 5 Jan 2022 11:20:55 +0000	[thread overview]
Message-ID: <bee03d1e-06dd-6243-e711-ab8d7c7081bb@linux.intel.com> (raw)
In-Reply-To: <875yqytqv4.fsf@intel.com>


On 05/01/2022 10:32, Jani Nikula wrote:
> On Wed, 05 Jan 2022, Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> wrote:
>> On 05/01/2022 10:05, Jani Nikula wrote:
>>> Follow the usual naming convention.
>>
>> But intel_uncore_ prefix usually means functions takes intel_uncore as
>> the first argument.
>>
>> Maybe solution here is that i915_reg_read_ioctl does not belong in
>> intel_uncore.c, it being the UAPI layer thing? I guess arguments could
>> be made for either way.
> 
> My position is that the function and file prefixes go hand in
> hand. You'll always know where to place a function, and you'll always
> know where the function is to be found.
> 
> If you can *also* make the context argument follow the pattern, it's
> obviously better, and indicates the division to files is working out
> nicely. However, in a lot of cases you'll need to pass struct
> drm_i915_private or similar as the first parameter to e.g. init
> functions. It can't be the rigid rule.
> 
> I'm fine with moving the entire function somewhere else, as long as the
> declaration is not in i915_drv.h. There's no longer a i915_drv.c, and
> i915_drv.h should not have function declarations at all.

Yes I agree it cannot be a rigid rule. I just that it feels 
intel_uncore.[hc] is too low level to me to hold an ioctl 
implementation, and header actually feels wrong to have the declaration. 
Not least it is about _one_ of the uncores, while the ioctl is not 
operating on that level, albeit undefined at the moment how exactly it 
would work for multi-tile.

Would it be too early, or unwarranted at this point, to maybe consider 
adding i915_ioctls.[hc]?

I like the i915_ prefix of ioctls for consistency.. i915_getparam_ioctl, 
i915_query_ioctl, i915_perf_..., i915_gem_....

Regards,

Tvrtko

> 
> BR,
> Jani.
> 
>>
>> Regards,
>>
>> Tvrtko
>>
>>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>>> ---
>>>    drivers/gpu/drm/i915/i915_driver.c  | 2 +-
>>>    drivers/gpu/drm/i915/intel_uncore.c | 4 ++--
>>>    drivers/gpu/drm/i915/intel_uncore.h | 4 ++--
>>>    3 files changed, 5 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c
>>> index 95174938b160..f9a494e159dc 100644
>>> --- a/drivers/gpu/drm/i915/i915_driver.c
>>> +++ b/drivers/gpu/drm/i915/i915_driver.c
>>> @@ -1805,7 +1805,7 @@ static const struct drm_ioctl_desc i915_ioctls[] = {
>>>    	DRM_IOCTL_DEF_DRV(I915_GEM_WAIT, i915_gem_wait_ioctl, DRM_RENDER_ALLOW),
>>>    	DRM_IOCTL_DEF_DRV(I915_GEM_CONTEXT_CREATE_EXT, i915_gem_context_create_ioctl, DRM_RENDER_ALLOW),
>>>    	DRM_IOCTL_DEF_DRV(I915_GEM_CONTEXT_DESTROY, i915_gem_context_destroy_ioctl, DRM_RENDER_ALLOW),
>>> -	DRM_IOCTL_DEF_DRV(I915_REG_READ, i915_reg_read_ioctl, DRM_RENDER_ALLOW),
>>> +	DRM_IOCTL_DEF_DRV(I915_REG_READ, intel_uncore_reg_read_ioctl, DRM_RENDER_ALLOW),
>>>    	DRM_IOCTL_DEF_DRV(I915_GET_RESET_STATS, i915_gem_context_reset_stats_ioctl, DRM_RENDER_ALLOW),
>>>    	DRM_IOCTL_DEF_DRV(I915_GEM_USERPTR, i915_gem_userptr_ioctl, DRM_RENDER_ALLOW),
>>>    	DRM_IOCTL_DEF_DRV(I915_GEM_CONTEXT_GETPARAM, i915_gem_context_getparam_ioctl, DRM_RENDER_ALLOW),
>>> diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c
>>> index fc25ebf1a593..33f95bb2d3d5 100644
>>> --- a/drivers/gpu/drm/i915/intel_uncore.c
>>> +++ b/drivers/gpu/drm/i915/intel_uncore.c
>>> @@ -2269,8 +2269,8 @@ static const struct reg_whitelist {
>>>    	.size = 8
>>>    } };
>>>    
>>> -int i915_reg_read_ioctl(struct drm_device *dev,
>>> -			void *data, struct drm_file *file)
>>> +int intel_uncore_reg_read_ioctl(struct drm_device *dev,
>>> +				void *data, struct drm_file *file)
>>>    {
>>>    	struct drm_i915_private *i915 = to_i915(dev);
>>>    	struct intel_uncore *uncore = &i915->uncore;
>>> diff --git a/drivers/gpu/drm/i915/intel_uncore.h b/drivers/gpu/drm/i915/intel_uncore.h
>>> index 3a87bbd906f8..697ac4586159 100644
>>> --- a/drivers/gpu/drm/i915/intel_uncore.h
>>> +++ b/drivers/gpu/drm/i915/intel_uncore.h
>>> @@ -457,7 +457,7 @@ static inline int intel_uncore_write_and_verify(struct intel_uncore *uncore,
>>>    #define raw_reg_write(base, reg, value) \
>>>    	writel(value, base + i915_mmio_reg_offset(reg))
>>>    
>>> -int i915_reg_read_ioctl(struct drm_device *dev, void *data,
>>> -			struct drm_file *file);
>>> +int intel_uncore_reg_read_ioctl(struct drm_device *dev, void *data,
>>> +				struct drm_file *file);
>>>    
>>>    #endif /* !__INTEL_UNCORE_H__ */
>>>
> 

  reply	other threads:[~2022-01-05 11:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-05 10:05 [Intel-gfx] [PATCH 1/2] drm/i915: move i915_reg_read_ioctl declaration to intel_uncore.h Jani Nikula
2022-01-05 10:05 ` [Intel-gfx] [PATCH 2/2] drm/i915/uncore: rename i915_reg_read_ioctl intel_uncore_reg_read_ioctl Jani Nikula
2022-01-05 10:11   ` Tvrtko Ursulin
2022-01-05 10:32     ` Jani Nikula
2022-01-05 11:20       ` Tvrtko Ursulin [this message]
2022-01-05 13:18         ` Jani Nikula
2022-01-05 14:33           ` Tvrtko Ursulin
2022-01-19 11:12             ` Jani Nikula
2022-01-20 10:36               ` Tvrtko Ursulin
2022-01-05 10:26 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for series starting with [1/2] drm/i915: move i915_reg_read_ioctl declaration to intel_uncore.h Patchwork
2022-01-05 10:55 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-01-05 12:13 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork

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=bee03d1e-06dd-6243-e711-ab8d7c7081bb@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).