From: Daniel Vetter <daniel@ffwll.ch>
To: Thomas Zimmermann <tzimmermann@suse.de>
Cc: cogarre@gmail.com, dri-devel@lists.freedesktop.org,
kraxel@redhat.com, airlied@redhat.com, sam@ravnborg.org,
emil.velikov@collabora.com
Subject: Re: [PATCH 1/5] drm/mgag200: Convert struct drm_device to struct mga_device with macro
Date: Tue, 5 May 2020 15:51:56 +0200 [thread overview]
Message-ID: <20200505135156.GQ10381@phenom.ffwll.local> (raw)
In-Reply-To: <20200505095649.25814-2-tzimmermann@suse.de>
On Tue, May 05, 2020 at 11:56:45AM +0200, Thomas Zimmermann wrote:
> Mgag200 used dev_private to look up struct mga_device for instances
> of struct drm_device. Use of dev_private is deprecated, so hide it in
> the macro to_mga_device().
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
> drivers/gpu/drm/mgag200/mgag200_cursor.c | 4 ++--
> drivers/gpu/drm/mgag200/mgag200_drv.c | 2 +-
> drivers/gpu/drm/mgag200/mgag200_drv.h | 1 +
> drivers/gpu/drm/mgag200/mgag200_i2c.c | 10 +++++-----
> drivers/gpu/drm/mgag200/mgag200_main.c | 4 ++--
> drivers/gpu/drm/mgag200/mgag200_mode.c | 18 +++++++++---------
> 6 files changed, 20 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/gpu/drm/mgag200/mgag200_cursor.c b/drivers/gpu/drm/mgag200/mgag200_cursor.c
> index d491edd317ff3..aebc9ce43d551 100644
> --- a/drivers/gpu/drm/mgag200/mgag200_cursor.c
> +++ b/drivers/gpu/drm/mgag200/mgag200_cursor.c
> @@ -260,7 +260,7 @@ int mgag200_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv,
> uint32_t handle, uint32_t width, uint32_t height)
> {
> struct drm_device *dev = crtc->dev;
> - struct mga_device *mdev = (struct mga_device *)dev->dev_private;
> + struct mga_device *mdev = to_mga_device(dev);
> struct drm_gem_object *obj;
> struct drm_gem_vram_object *gbo = NULL;
> int ret;
> @@ -307,7 +307,7 @@ int mgag200_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv,
>
> int mgag200_crtc_cursor_move(struct drm_crtc *crtc, int x, int y)
> {
> - struct mga_device *mdev = (struct mga_device *)crtc->dev->dev_private;
> + struct mga_device *mdev = to_mga_device(crtc->dev);
>
> /* Our origin is at (64,64) */
> x += 64;
> diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c b/drivers/gpu/drm/mgag200/mgag200_drv.c
> index 3298b7ef18b03..c2f0e4b40b052 100644
> --- a/drivers/gpu/drm/mgag200/mgag200_drv.c
> +++ b/drivers/gpu/drm/mgag200/mgag200_drv.c
> @@ -120,7 +120,7 @@ int mgag200_driver_dumb_create(struct drm_file *file,
> struct drm_device *dev,
> struct drm_mode_create_dumb *args)
> {
> - struct mga_device *mdev = dev->dev_private;
> + struct mga_device *mdev = to_mga_device(dev);
> unsigned long pg_align;
>
> if (WARN_ONCE(!dev->vram_mm, "VRAM MM not initialized"))
> diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.h b/drivers/gpu/drm/mgag200/mgag200_drv.h
> index 9691252d6233f..632bbb50465c9 100644
> --- a/drivers/gpu/drm/mgag200/mgag200_drv.h
> +++ b/drivers/gpu/drm/mgag200/mgag200_drv.h
> @@ -96,6 +96,7 @@
>
> #define to_mga_crtc(x) container_of(x, struct mga_crtc, base)
> #define to_mga_connector(x) container_of(x, struct mga_connector, base)
> +#define to_mga_device(x) ((struct mga_device *)(x)->dev_private)
>
> struct mga_crtc {
> struct drm_crtc base;
> diff --git a/drivers/gpu/drm/mgag200/mgag200_i2c.c b/drivers/gpu/drm/mgag200/mgag200_i2c.c
> index 9f4635916d322..09731e614e46d 100644
> --- a/drivers/gpu/drm/mgag200/mgag200_i2c.c
> +++ b/drivers/gpu/drm/mgag200/mgag200_i2c.c
> @@ -61,34 +61,34 @@ static inline void mga_i2c_set(struct mga_device *mdev, int mask, int state)
> static void mga_gpio_setsda(void *data, int state)
> {
> struct mga_i2c_chan *i2c = data;
> - struct mga_device *mdev = i2c->dev->dev_private;
> + struct mga_device *mdev = to_mga_device(i2c->dev);
> mga_i2c_set(mdev, i2c->data, state);
> }
>
> static void mga_gpio_setscl(void *data, int state)
> {
> struct mga_i2c_chan *i2c = data;
> - struct mga_device *mdev = i2c->dev->dev_private;
> + struct mga_device *mdev = to_mga_device(i2c->dev);
> mga_i2c_set(mdev, i2c->clock, state);
> }
>
> static int mga_gpio_getsda(void *data)
> {
> struct mga_i2c_chan *i2c = data;
> - struct mga_device *mdev = i2c->dev->dev_private;
> + struct mga_device *mdev = to_mga_device(i2c->dev);
> return (mga_i2c_read_gpio(mdev) & i2c->data) ? 1 : 0;
> }
>
> static int mga_gpio_getscl(void *data)
> {
> struct mga_i2c_chan *i2c = data;
> - struct mga_device *mdev = i2c->dev->dev_private;
> + struct mga_device *mdev = to_mga_device(i2c->dev);
> return (mga_i2c_read_gpio(mdev) & i2c->clock) ? 1 : 0;
> }
>
> struct mga_i2c_chan *mgag200_i2c_create(struct drm_device *dev)
> {
> - struct mga_device *mdev = dev->dev_private;
> + struct mga_device *mdev = to_mga_device(dev);
> struct mga_i2c_chan *i2c;
> int ret;
> int data, clock;
> diff --git a/drivers/gpu/drm/mgag200/mgag200_main.c b/drivers/gpu/drm/mgag200/mgag200_main.c
> index b680cf47cbb94..b705b7776d2fc 100644
> --- a/drivers/gpu/drm/mgag200/mgag200_main.c
> +++ b/drivers/gpu/drm/mgag200/mgag200_main.c
> @@ -92,7 +92,7 @@ static int mga_vram_init(struct mga_device *mdev)
> static int mgag200_device_init(struct drm_device *dev,
> uint32_t flags)
> {
> - struct mga_device *mdev = dev->dev_private;
> + struct mga_device *mdev = to_mga_device(dev);
> int ret, option;
>
> mdev->flags = mgag200_flags_from_driver_data(flags);
> @@ -195,7 +195,7 @@ int mgag200_driver_load(struct drm_device *dev, unsigned long flags)
>
> void mgag200_driver_unload(struct drm_device *dev)
> {
> - struct mga_device *mdev = dev->dev_private;
> + struct mga_device *mdev = to_mga_device(dev);
>
> if (mdev == NULL)
> return;
> diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c
> index d90e83959fca1..fa91869c0db52 100644
> --- a/drivers/gpu/drm/mgag200/mgag200_mode.c
> +++ b/drivers/gpu/drm/mgag200/mgag200_mode.c
> @@ -28,7 +28,7 @@
> static void mga_crtc_load_lut(struct drm_crtc *crtc)
> {
> struct drm_device *dev = crtc->dev;
> - struct mga_device *mdev = dev->dev_private;
> + struct mga_device *mdev = to_mga_device(dev);
> struct drm_framebuffer *fb = crtc->primary->fb;
> u16 *r_ptr, *g_ptr, *b_ptr;
> int i;
> @@ -728,7 +728,7 @@ static int mga_crtc_set_plls(struct mga_device *mdev, long clock)
>
> static void mga_g200wb_prepare(struct drm_crtc *crtc)
> {
> - struct mga_device *mdev = crtc->dev->dev_private;
> + struct mga_device *mdev = to_mga_device(crtc->dev);
> u8 tmp;
> int iter_max;
>
> @@ -783,7 +783,7 @@ static void mga_g200wb_prepare(struct drm_crtc *crtc)
> static void mga_g200wb_commit(struct drm_crtc *crtc)
> {
> u8 tmp;
> - struct mga_device *mdev = crtc->dev->dev_private;
> + struct mga_device *mdev = to_mga_device(crtc->dev);
>
> /* 1- The first step is to ensure that the vrsten and hrsten are set */
> WREG8(MGAREG_CRTCEXT_INDEX, 1);
> @@ -833,7 +833,7 @@ static void mga_g200wb_commit(struct drm_crtc *crtc)
> */
> static void mga_set_start_address(struct drm_crtc *crtc, unsigned offset)
> {
> - struct mga_device *mdev = crtc->dev->dev_private;
> + struct mga_device *mdev = to_mga_device(crtc->dev);
> u32 addr;
> int count;
> u8 crtcext0;
> @@ -902,7 +902,7 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc,
> int x, int y, struct drm_framebuffer *old_fb)
> {
> struct drm_device *dev = crtc->dev;
> - struct mga_device *mdev = dev->dev_private;
> + struct mga_device *mdev = to_mga_device(dev);
> const struct drm_framebuffer *fb = crtc->primary->fb;
> int hdisplay, hsyncstart, hsyncend, htotal;
> int vdisplay, vsyncstart, vsyncend, vtotal;
> @@ -1263,7 +1263,7 @@ static int mga_resume(struct drm_crtc *crtc)
> static void mga_crtc_dpms(struct drm_crtc *crtc, int mode)
> {
> struct drm_device *dev = crtc->dev;
> - struct mga_device *mdev = dev->dev_private;
> + struct mga_device *mdev = to_mga_device(dev);
> u8 seq1 = 0, crtcext1 = 0;
>
> switch (mode) {
> @@ -1317,7 +1317,7 @@ static void mga_crtc_dpms(struct drm_crtc *crtc, int mode)
> static void mga_crtc_prepare(struct drm_crtc *crtc)
> {
> struct drm_device *dev = crtc->dev;
> - struct mga_device *mdev = dev->dev_private;
> + struct mga_device *mdev = to_mga_device(dev);
> u8 tmp;
>
> /* mga_resume(crtc);*/
> @@ -1353,7 +1353,7 @@ static void mga_crtc_prepare(struct drm_crtc *crtc)
> static void mga_crtc_commit(struct drm_crtc *crtc)
> {
> struct drm_device *dev = crtc->dev;
> - struct mga_device *mdev = dev->dev_private;
> + struct mga_device *mdev = to_mga_device(dev);
> const struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;
> u8 tmp;
>
> @@ -1495,7 +1495,7 @@ static enum drm_mode_status mga_vga_mode_valid(struct drm_connector *connector,
> struct drm_display_mode *mode)
> {
> struct drm_device *dev = connector->dev;
> - struct mga_device *mdev = (struct mga_device*)dev->dev_private;
> + struct mga_device *mdev = to_mga_device(dev);
> int bpp = 32;
>
> if (IS_G200_SE(mdev)) {
> --
> 2.26.0
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2020-05-05 13:52 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-05 9:56 [PATCH 0/5] drm/mgag200: Embed DRM device in struct mga_device Thomas Zimmermann
2020-05-05 9:56 ` [PATCH 1/5] drm/mgag200: Convert struct drm_device to struct mga_device with macro Thomas Zimmermann
2020-05-05 13:51 ` Daniel Vetter [this message]
2020-05-05 16:36 ` Sam Ravnborg
2020-05-06 11:06 ` Daniel Vetter
2020-05-05 9:56 ` [PATCH 2/5] drm/mgag200: Integrate init function into load function Thomas Zimmermann
2020-05-05 14:05 ` Daniel Vetter
2020-05-05 16:40 ` Sam Ravnborg
2020-05-05 9:56 ` [PATCH 3/5] drm/mgag200: Remove several references to struct mga_device.dev Thomas Zimmermann
2020-05-05 14:09 ` Daniel Vetter
2020-05-06 7:48 ` Thomas Zimmermann
2020-05-06 9:22 ` Daniel Vetter
2020-05-05 16:43 ` Sam Ravnborg
2020-05-05 9:56 ` [PATCH 4/5] drm/mgag200: Init and finalize devices in mgag200_device_{init, fini}() Thomas Zimmermann
2020-05-05 14:14 ` [PATCH 4/5] drm/mgag200: Init and finalize devices in mgag200_device_{init,fini}() Daniel Vetter
2020-05-06 7:57 ` Thomas Zimmermann
2020-05-05 16:49 ` Sam Ravnborg
2020-05-06 7:59 ` Thomas Zimmermann
2020-05-05 9:56 ` [PATCH 5/5] drm/mgag200: Embed DRM device instance in struct mga_device Thomas Zimmermann
2020-05-05 14:18 ` Daniel Vetter
2020-05-05 16:30 ` [PATCH 0/5] drm/mgag200: Embed DRM device " Sam Ravnborg
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=20200505135156.GQ10381@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=airlied@redhat.com \
--cc=cogarre@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=emil.velikov@collabora.com \
--cc=kraxel@redhat.com \
--cc=sam@ravnborg.org \
--cc=tzimmermann@suse.de \
/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).