summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/mgag200
diff options
context:
space:
mode:
authorThomas Zimmermann <tzimmermann@suse.de>2024-05-13 14:51:08 +0200
committerThomas Zimmermann <tzimmermann@suse.de>2024-05-17 17:20:05 +0200
commit23368d7b9c1a7d7f0b1435f69a3bee12d836b2ec (patch)
treea3d2acc3196f473a619864365246f925425bf6db /drivers/gpu/drm/mgag200
parentdrm/mgag200: Bind I2C lifetime to DRM device (diff)
downloadlinux-23368d7b9c1a7d7f0b1435f69a3bee12d836b2ec.tar.xz
linux-23368d7b9c1a7d7f0b1435f69a3bee12d836b2ec.zip
drm/mgag200: Store pointer to struct mga_device in struct mga_i2c_chan
Avoid upcasting to struct mga_device in i2c code by storing the pointer directly. No functional changes. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240513125620.6337-4-tzimmermann@suse.de
Diffstat (limited to 'drivers/gpu/drm/mgag200')
-rw-r--r--drivers/gpu/drm/mgag200/mgag200_drv.h2
-rw-r--r--drivers/gpu/drm/mgag200/mgag200_i2c.c18
2 files changed, 10 insertions, 10 deletions
diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.h b/drivers/gpu/drm/mgag200/mgag200_drv.h
index 58a0e62eaf18..c7d4047301bf 100644
--- a/drivers/gpu/drm/mgag200/mgag200_drv.h
+++ b/drivers/gpu/drm/mgag200/mgag200_drv.h
@@ -191,7 +191,7 @@ static inline struct mgag200_crtc_state *to_mgag200_crtc_state(struct drm_crtc_s
struct mga_i2c_chan {
struct i2c_adapter adapter;
- struct drm_device *dev;
+ struct mga_device *mdev;
struct i2c_algo_bit_data bit;
int data, clock;
};
diff --git a/drivers/gpu/drm/mgag200/mgag200_i2c.c b/drivers/gpu/drm/mgag200/mgag200_i2c.c
index 4caeb68f3010..effd7c057fce 100644
--- a/drivers/gpu/drm/mgag200/mgag200_i2c.c
+++ b/drivers/gpu/drm/mgag200/mgag200_i2c.c
@@ -63,29 +63,29 @@ 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 = to_mga_device(i2c->dev);
- mga_i2c_set(mdev, i2c->data, state);
+
+ mga_i2c_set(i2c->mdev, i2c->data, state);
}
static void mga_gpio_setscl(void *data, int state)
{
struct mga_i2c_chan *i2c = data;
- struct mga_device *mdev = to_mga_device(i2c->dev);
- mga_i2c_set(mdev, i2c->clock, state);
+
+ mga_i2c_set(i2c->mdev, i2c->clock, state);
}
static int mga_gpio_getsda(void *data)
{
struct mga_i2c_chan *i2c = data;
- struct mga_device *mdev = to_mga_device(i2c->dev);
- return (mga_i2c_read_gpio(mdev) & i2c->data) ? 1 : 0;
+
+ return (mga_i2c_read_gpio(i2c->mdev) & i2c->data) ? 1 : 0;
}
static int mga_gpio_getscl(void *data)
{
struct mga_i2c_chan *i2c = data;
- struct mga_device *mdev = to_mga_device(i2c->dev);
- return (mga_i2c_read_gpio(mdev) & i2c->clock) ? 1 : 0;
+
+ return (mga_i2c_read_gpio(i2c->mdev) & i2c->clock) ? 1 : 0;
}
static void mgag200_i2c_release(struct drm_device *dev, void *res)
@@ -109,7 +109,7 @@ int mgag200_i2c_init(struct mga_device *mdev, struct mga_i2c_chan *i2c)
i2c->clock = BIT(info->i2c.clock_bit);
i2c->adapter.owner = THIS_MODULE;
i2c->adapter.dev.parent = dev->dev;
- i2c->dev = dev;
+ i2c->mdev = mdev;
i2c_set_adapdata(&i2c->adapter, i2c);
snprintf(i2c->adapter.name, sizeof(i2c->adapter.name), "mga i2c");