forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/drivers/gpu/drm/mgag200/mgag200_i2c.c
....@@ -25,10 +25,11 @@
2525 /*
2626 * Authors: Dave Airlie <airlied@redhat.com>
2727 */
28
+
2829 #include <linux/export.h>
29
-#include <linux/i2c.h>
3030 #include <linux/i2c-algo-bit.h>
31
-#include <drm/drmP.h>
31
+#include <linux/i2c.h>
32
+#include <linux/pci.h>
3233
3334 #include "mgag200_drv.h"
3435
....@@ -60,34 +61,34 @@
6061 static void mga_gpio_setsda(void *data, int state)
6162 {
6263 struct mga_i2c_chan *i2c = data;
63
- struct mga_device *mdev = i2c->dev->dev_private;
64
+ struct mga_device *mdev = to_mga_device(i2c->dev);
6465 mga_i2c_set(mdev, i2c->data, state);
6566 }
6667
6768 static void mga_gpio_setscl(void *data, int state)
6869 {
6970 struct mga_i2c_chan *i2c = data;
70
- struct mga_device *mdev = i2c->dev->dev_private;
71
+ struct mga_device *mdev = to_mga_device(i2c->dev);
7172 mga_i2c_set(mdev, i2c->clock, state);
7273 }
7374
7475 static int mga_gpio_getsda(void *data)
7576 {
7677 struct mga_i2c_chan *i2c = data;
77
- struct mga_device *mdev = i2c->dev->dev_private;
78
+ struct mga_device *mdev = to_mga_device(i2c->dev);
7879 return (mga_i2c_read_gpio(mdev) & i2c->data) ? 1 : 0;
7980 }
8081
8182 static int mga_gpio_getscl(void *data)
8283 {
8384 struct mga_i2c_chan *i2c = data;
84
- struct mga_device *mdev = i2c->dev->dev_private;
85
+ struct mga_device *mdev = to_mga_device(i2c->dev);
8586 return (mga_i2c_read_gpio(mdev) & i2c->clock) ? 1 : 0;
8687 }
8788
8889 struct mga_i2c_chan *mgag200_i2c_create(struct drm_device *dev)
8990 {
90
- struct mga_device *mdev = dev->dev_private;
91
+ struct mga_device *mdev = to_mga_device(dev);
9192 struct mga_i2c_chan *i2c;
9293 int ret;
9394 int data, clock;