diff mbox

[3/9] drm: Make sure every ioctl structure has a typedef

Message ID 1378493845-476-4-git-send-email-damien.lespiau@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Lespiau, Damien Sept. 6, 2013, 6:57 p.m. UTC
Just for consistency.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
---
 include/uapi/drm/drm.h | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

Comments

Daniel Vetter Sept. 8, 2013, 11:58 a.m. UTC | #1
On Fri, Sep 06, 2013 at 07:57:19PM +0100, Damien Lespiau wrote:
> Just for consistency.
> 
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>

Afaik kernel coding style is to echew typdefs for normal structures as
much as possible. The only exception is for truly opaque types used in
abstractions, like dma_addr_t or pid_t.

All the typedefs we still have here go back to the old days of a drm core
shared between *bsd and linux. Since that's long gone they imo should all
die, but certainly we shouldn't add new ones.

Aside: My patcha apply script will also bitch about new usages of
drm_i915_private_t ;-)

Cheers, Daniel
> ---
>  include/uapi/drm/drm.h | 29 +++++++++++++++++++++++++++++
>  1 file changed, 29 insertions(+)
> 
> diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h
> index b8604d2..0430fab 100644
> --- a/include/uapi/drm/drm.h
> +++ b/include/uapi/drm/drm.h
> @@ -799,6 +799,11 @@ typedef struct drm_client drm_client_t;
>  typedef enum drm_stat_type drm_stat_type_t;
>  typedef struct drm_stats drm_stats_t;
>  typedef struct drm_set_version drm_set_version_t;
> +typedef struct drm_modeset_ctl drm_modeset_ctl_t;
> +typedef struct drm_gem_close drm_gem_close_t;
> +typedef struct drm_gem_flink drm_gem_flink_t;
> +typedef struct drm_gem_open drm_gem_open_t;
> +typedef struct drm_get_cap drm_get_cap_t;
>  typedef struct drm_block drm_block_t;
>  typedef struct drm_control drm_control_t;
>  typedef struct drm_buf_desc drm_buf_desc_t;
> @@ -815,6 +820,7 @@ typedef struct drm_ctx_res drm_ctx_res_t;
>  typedef struct drm_draw drm_draw_t;
>  typedef enum drm_lock_flags drm_lock_flags_t;
>  typedef struct drm_lock drm_lock_t;
> +typedef struct drm_prime_handle drm_prime_handle_t;
>  typedef struct drm_agp_mode drm_agp_mode_t;
>  typedef struct drm_agp_info drm_agp_info_t;
>  typedef struct drm_agp_buffer drm_agp_buffer_t;
> @@ -823,6 +829,29 @@ typedef struct drm_scatter_gather drm_scatter_gather_t;
>  typedef enum drm_vblank_seq_type drm_vblank_seq_type_t;
>  typedef union drm_wait_vblank drm_wait_vblank_t;
>  typedef struct drm_update_draw drm_update_draw_t;
> +typedef struct drm_mode_card_res drm_mode_card_res_t;
> +typedef struct drm_mode_crtc drm_mode_crtc_t;
> +typedef struct drm_mode_cursor drm_mode_cursor_t;
> +typedef struct drm_mode_crtc_lut drm_mode_crtc_lut_t;
> +typedef struct drm_mode_get_encoder drm_mode_get_encoder_t;
> +typedef struct drm_mode_get_connector drm_mode_get_connector_t;
> +typedef struct drm_mode_mode_cmd drm_mode_mode_cmd_t;
> +typedef struct drm_mode_get_property drm_mode_get_property_t;
> +typedef struct drm_mode_connector_set_property drm_mode_connector_set_property_t;
> +typedef struct drm_mode_get_blob drm_mode_get_blob_t;
> +typedef struct drm_mode_fb_cmd drm_mode_fb_cmd_t;
> +typedef struct drm_mode_crtc_page_flip drm_mode_crtc_page_flip_t;
> +typedef struct drm_mode_fb_dirty_cmd drm_mode_fb_dirty_cmd_t;
> +typedef struct drm_mode_create_dumb drm_mode_create_dumb_t;
> +typedef struct drm_mode_map_dumb drm_mode_map_dumb_t;
> +typedef struct drm_mode_destroy_dumb drm_mode_destroy_dumb_t;
> +typedef struct drm_mode_get_plane_res drm_mode_get_plane_res_t;
> +typedef struct drm_mode_get_plane drm_mode_get_plane_t;
> +typedef struct drm_mode_set_plane drm_mode_set_plane_t;
> +typedef struct drm_mode_fb_cmd2 drm_mode_fb_cmd2_t;
> +typedef struct drm_mode_obj_get_properties drm_mode_obj_get_properties_t;
> +typedef struct drm_mode_obj_set_property drm_mode_obj_set_property_t;
> +typedef struct drm_mode_cursor2 drm_mode_cursor2_t;
>  
>  typedef struct drm_clip_rect drm_clip_rect_t;
>  typedef struct drm_drawable_info drm_drawable_info_t;
> -- 
> 1.8.3.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
Lespiau, Damien Sept. 8, 2013, 7:36 p.m. UTC | #2
On Sun, Sep 08, 2013 at 01:58:29PM +0200, Daniel Vetter wrote:
> On Fri, Sep 06, 2013 at 07:57:19PM +0100, Damien Lespiau wrote:
> > Just for consistency.
> > 
> > Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
> 
> Afaik kernel coding style is to echew typdefs for normal structures as
> much as possible. The only exception is for truly opaque types used in
> abstractions, like dma_addr_t or pid_t.
> 
> All the typedefs we still have here go back to the old days of a drm core
> shared between *bsd and linux. Since that's long gone they imo should all
> die, but certainly we shouldn't add new ones.

I figured that since we where talking about user space API, the kernel
rules wouldn't apply there and we could have some consistency, but I
certainly can just drop those patches.
Daniel Vetter Sept. 8, 2013, 8:04 p.m. UTC | #3
On Sun, Sep 8, 2013 at 9:36 PM, Damien Lespiau <damien.lespiau@intel.com> wrote:
> On Sun, Sep 08, 2013 at 01:58:29PM +0200, Daniel Vetter wrote:
>> On Fri, Sep 06, 2013 at 07:57:19PM +0100, Damien Lespiau wrote:
>> > Just for consistency.
>> >
>> > Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
>>
>> Afaik kernel coding style is to echew typdefs for normal structures as
>> much as possible. The only exception is for truly opaque types used in
>> abstractions, like dma_addr_t or pid_t.
>>
>> All the typedefs we still have here go back to the old days of a drm core
>> shared between *bsd and linux. Since that's long gone they imo should all
>> die, but certainly we shouldn't add new ones.
>
> I figured that since we where talking about user space API, the kernel
> rules wouldn't apply there and we could have some consistency, but I
> certainly can just drop those patches.

I've thought typedefs are even frowned upon in the ioctl abi -
magically changing sized types cause pain since they need 32bit compat
wrappers. And otherwise I haven't really seen them much for structures
...
-Daniel
diff mbox

Patch

diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h
index b8604d2..0430fab 100644
--- a/include/uapi/drm/drm.h
+++ b/include/uapi/drm/drm.h
@@ -799,6 +799,11 @@  typedef struct drm_client drm_client_t;
 typedef enum drm_stat_type drm_stat_type_t;
 typedef struct drm_stats drm_stats_t;
 typedef struct drm_set_version drm_set_version_t;
+typedef struct drm_modeset_ctl drm_modeset_ctl_t;
+typedef struct drm_gem_close drm_gem_close_t;
+typedef struct drm_gem_flink drm_gem_flink_t;
+typedef struct drm_gem_open drm_gem_open_t;
+typedef struct drm_get_cap drm_get_cap_t;
 typedef struct drm_block drm_block_t;
 typedef struct drm_control drm_control_t;
 typedef struct drm_buf_desc drm_buf_desc_t;
@@ -815,6 +820,7 @@  typedef struct drm_ctx_res drm_ctx_res_t;
 typedef struct drm_draw drm_draw_t;
 typedef enum drm_lock_flags drm_lock_flags_t;
 typedef struct drm_lock drm_lock_t;
+typedef struct drm_prime_handle drm_prime_handle_t;
 typedef struct drm_agp_mode drm_agp_mode_t;
 typedef struct drm_agp_info drm_agp_info_t;
 typedef struct drm_agp_buffer drm_agp_buffer_t;
@@ -823,6 +829,29 @@  typedef struct drm_scatter_gather drm_scatter_gather_t;
 typedef enum drm_vblank_seq_type drm_vblank_seq_type_t;
 typedef union drm_wait_vblank drm_wait_vblank_t;
 typedef struct drm_update_draw drm_update_draw_t;
+typedef struct drm_mode_card_res drm_mode_card_res_t;
+typedef struct drm_mode_crtc drm_mode_crtc_t;
+typedef struct drm_mode_cursor drm_mode_cursor_t;
+typedef struct drm_mode_crtc_lut drm_mode_crtc_lut_t;
+typedef struct drm_mode_get_encoder drm_mode_get_encoder_t;
+typedef struct drm_mode_get_connector drm_mode_get_connector_t;
+typedef struct drm_mode_mode_cmd drm_mode_mode_cmd_t;
+typedef struct drm_mode_get_property drm_mode_get_property_t;
+typedef struct drm_mode_connector_set_property drm_mode_connector_set_property_t;
+typedef struct drm_mode_get_blob drm_mode_get_blob_t;
+typedef struct drm_mode_fb_cmd drm_mode_fb_cmd_t;
+typedef struct drm_mode_crtc_page_flip drm_mode_crtc_page_flip_t;
+typedef struct drm_mode_fb_dirty_cmd drm_mode_fb_dirty_cmd_t;
+typedef struct drm_mode_create_dumb drm_mode_create_dumb_t;
+typedef struct drm_mode_map_dumb drm_mode_map_dumb_t;
+typedef struct drm_mode_destroy_dumb drm_mode_destroy_dumb_t;
+typedef struct drm_mode_get_plane_res drm_mode_get_plane_res_t;
+typedef struct drm_mode_get_plane drm_mode_get_plane_t;
+typedef struct drm_mode_set_plane drm_mode_set_plane_t;
+typedef struct drm_mode_fb_cmd2 drm_mode_fb_cmd2_t;
+typedef struct drm_mode_obj_get_properties drm_mode_obj_get_properties_t;
+typedef struct drm_mode_obj_set_property drm_mode_obj_set_property_t;
+typedef struct drm_mode_cursor2 drm_mode_cursor2_t;
 
 typedef struct drm_clip_rect drm_clip_rect_t;
 typedef struct drm_drawable_info drm_drawable_info_t;