Skip to content

Commit

Permalink
drm/udl: introduce a macro to convert dev to udl.
Browse files Browse the repository at this point in the history
This just makes it easier to later embed drm into udl.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190405031715.5959-3-airlied@gmail.com
  • Loading branch information
Dave Airlie committed Apr 24, 2019
1 parent 331ca3a commit fd96e0d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
2 changes: 2 additions & 0 deletions drivers/gpu/drm/udl/udl_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ struct udl_device {
atomic_t cpu_kcycles_used; /* transpired during pixel processing */
};

#define to_udl(x) ((x)->dev_private)

struct udl_gem_object {
struct drm_gem_object base;
struct page **pages;
Expand Down
10 changes: 5 additions & 5 deletions drivers/gpu/drm/udl/udl_fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ int udl_handle_damage(struct udl_framebuffer *fb, int x, int y,
int width, int height)
{
struct drm_device *dev = fb->base.dev;
struct udl_device *udl = dev->dev_private;
struct udl_device *udl = to_udl(dev);
int i, ret;
char *cmd;
cycles_t start_cycles, end_cycles;
Expand Down Expand Up @@ -210,7 +210,7 @@ static int udl_fb_open(struct fb_info *info, int user)
{
struct udl_fbdev *ufbdev = info->par;
struct drm_device *dev = ufbdev->ufb.base.dev;
struct udl_device *udl = dev->dev_private;
struct udl_device *udl = to_udl(dev);

/* If the USB device is gone, we don't accept new opens */
if (drm_dev_is_unplugged(udl->ddev))
Expand Down Expand Up @@ -437,7 +437,7 @@ static void udl_fbdev_destroy(struct drm_device *dev,

int udl_fbdev_init(struct drm_device *dev)
{
struct udl_device *udl = dev->dev_private;
struct udl_device *udl = to_udl(dev);
int bpp_sel = fb_bpp;
struct udl_fbdev *ufbdev;
int ret;
Expand Down Expand Up @@ -476,7 +476,7 @@ int udl_fbdev_init(struct drm_device *dev)

void udl_fbdev_cleanup(struct drm_device *dev)
{
struct udl_device *udl = dev->dev_private;
struct udl_device *udl = to_udl(dev);
if (!udl->fbdev)
return;

Expand All @@ -487,7 +487,7 @@ void udl_fbdev_cleanup(struct drm_device *dev)

void udl_fbdev_unplug(struct drm_device *dev)
{
struct udl_device *udl = dev->dev_private;
struct udl_device *udl = to_udl(dev);
struct udl_fbdev *ufbdev;
if (!udl->fbdev)
return;
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/udl/udl_gem.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ int udl_gem_mmap(struct drm_file *file, struct drm_device *dev,
{
struct udl_gem_object *gobj;
struct drm_gem_object *obj;
struct udl_device *udl = dev->dev_private;
struct udl_device *udl = to_udl(dev);
int ret = 0;

mutex_lock(&udl->gem_lock);
Expand Down
12 changes: 6 additions & 6 deletions drivers/gpu/drm/udl/udl_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
static int udl_parse_vendor_descriptor(struct drm_device *dev,
struct usb_device *usbdev)
{
struct udl_device *udl = dev->dev_private;
struct udl_device *udl = to_udl(dev);
char *desc;
char *buf;
char *desc_end;
Expand Down Expand Up @@ -166,7 +166,7 @@ void udl_urb_completion(struct urb *urb)

static void udl_free_urb_list(struct drm_device *dev)
{
struct udl_device *udl = dev->dev_private;
struct udl_device *udl = to_udl(dev);
int count = udl->urbs.count;
struct list_head *node;
struct urb_node *unode;
Expand Down Expand Up @@ -199,7 +199,7 @@ static void udl_free_urb_list(struct drm_device *dev)

static int udl_alloc_urb_list(struct drm_device *dev, int count, size_t size)
{
struct udl_device *udl = dev->dev_private;
struct udl_device *udl = to_udl(dev);
struct urb *urb;
struct urb_node *unode;
char *buf;
Expand Down Expand Up @@ -263,7 +263,7 @@ static int udl_alloc_urb_list(struct drm_device *dev, int count, size_t size)

struct urb *udl_get_urb(struct drm_device *dev)
{
struct udl_device *udl = dev->dev_private;
struct udl_device *udl = to_udl(dev);
int ret = 0;
struct list_head *entry;
struct urb_node *unode;
Expand Down Expand Up @@ -296,7 +296,7 @@ struct urb *udl_get_urb(struct drm_device *dev)

int udl_submit_urb(struct drm_device *dev, struct urb *urb, size_t len)
{
struct udl_device *udl = dev->dev_private;
struct udl_device *udl = to_udl(dev);
int ret;

BUG_ON(len > udl->urbs.size);
Expand Down Expand Up @@ -371,7 +371,7 @@ int udl_drop_usb(struct drm_device *dev)

void udl_driver_unload(struct drm_device *dev)
{
struct udl_device *udl = dev->dev_private;
struct udl_device *udl = to_udl(dev);

drm_kms_helper_poll_fini(dev);

Expand Down

0 comments on commit fd96e0d

Please sign in to comment.