drm/nouveau/fbcon: make use of drm_fb_helper.dev

No need to store the pointer ourselves when it's already present in
the base struct.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
This commit is contained in:
Ben Skeggs 2016-11-04 17:20:35 +10:00
parent 725fa3ac39
commit 9dec928052
5 changed files with 20 additions and 22 deletions

View File

@ -58,7 +58,7 @@ static void
nouveau_fbcon_fillrect(struct fb_info *info, const struct fb_fillrect *rect) nouveau_fbcon_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
{ {
struct nouveau_fbdev *fbcon = info->par; struct nouveau_fbdev *fbcon = info->par;
struct nouveau_drm *drm = nouveau_drm(fbcon->dev); struct nouveau_drm *drm = nouveau_drm(fbcon->helper.dev);
struct nvif_device *device = &drm->device; struct nvif_device *device = &drm->device;
int ret; int ret;
@ -90,7 +90,7 @@ static void
nouveau_fbcon_copyarea(struct fb_info *info, const struct fb_copyarea *image) nouveau_fbcon_copyarea(struct fb_info *info, const struct fb_copyarea *image)
{ {
struct nouveau_fbdev *fbcon = info->par; struct nouveau_fbdev *fbcon = info->par;
struct nouveau_drm *drm = nouveau_drm(fbcon->dev); struct nouveau_drm *drm = nouveau_drm(fbcon->helper.dev);
struct nvif_device *device = &drm->device; struct nvif_device *device = &drm->device;
int ret; int ret;
@ -122,7 +122,7 @@ static void
nouveau_fbcon_imageblit(struct fb_info *info, const struct fb_image *image) nouveau_fbcon_imageblit(struct fb_info *info, const struct fb_image *image)
{ {
struct nouveau_fbdev *fbcon = info->par; struct nouveau_fbdev *fbcon = info->par;
struct nouveau_drm *drm = nouveau_drm(fbcon->dev); struct nouveau_drm *drm = nouveau_drm(fbcon->helper.dev);
struct nvif_device *device = &drm->device; struct nvif_device *device = &drm->device;
int ret; int ret;
@ -154,7 +154,7 @@ static int
nouveau_fbcon_sync(struct fb_info *info) nouveau_fbcon_sync(struct fb_info *info)
{ {
struct nouveau_fbdev *fbcon = info->par; struct nouveau_fbdev *fbcon = info->par;
struct nouveau_drm *drm = nouveau_drm(fbcon->dev); struct nouveau_drm *drm = nouveau_drm(fbcon->helper.dev);
struct nouveau_channel *chan = drm->channel; struct nouveau_channel *chan = drm->channel;
int ret; int ret;
@ -181,7 +181,7 @@ static int
nouveau_fbcon_open(struct fb_info *info, int user) nouveau_fbcon_open(struct fb_info *info, int user)
{ {
struct nouveau_fbdev *fbcon = info->par; struct nouveau_fbdev *fbcon = info->par;
struct nouveau_drm *drm = nouveau_drm(fbcon->dev); struct nouveau_drm *drm = nouveau_drm(fbcon->helper.dev);
int ret = pm_runtime_get_sync(drm->dev->dev); int ret = pm_runtime_get_sync(drm->dev->dev);
if (ret < 0 && ret != -EACCES) if (ret < 0 && ret != -EACCES)
return ret; return ret;
@ -192,7 +192,7 @@ static int
nouveau_fbcon_release(struct fb_info *info, int user) nouveau_fbcon_release(struct fb_info *info, int user)
{ {
struct nouveau_fbdev *fbcon = info->par; struct nouveau_fbdev *fbcon = info->par;
struct nouveau_drm *drm = nouveau_drm(fbcon->dev); struct nouveau_drm *drm = nouveau_drm(fbcon->helper.dev);
pm_runtime_put(drm->dev->dev); pm_runtime_put(drm->dev->dev);
return 0; return 0;
} }
@ -333,7 +333,7 @@ nouveau_fbcon_create(struct drm_fb_helper *helper,
{ {
struct nouveau_fbdev *fbcon = struct nouveau_fbdev *fbcon =
container_of(helper, struct nouveau_fbdev, helper); container_of(helper, struct nouveau_fbdev, helper);
struct drm_device *dev = fbcon->dev; struct drm_device *dev = fbcon->helper.dev;
struct nouveau_drm *drm = nouveau_drm(dev); struct nouveau_drm *drm = nouveau_drm(dev);
struct nvif_device *device = &drm->device; struct nvif_device *device = &drm->device;
struct fb_info *info; struct fb_info *info;
@ -479,7 +479,7 @@ nouveau_fbcon_destroy(struct drm_device *dev, struct nouveau_fbdev *fbcon)
void nouveau_fbcon_gpu_lockup(struct fb_info *info) void nouveau_fbcon_gpu_lockup(struct fb_info *info)
{ {
struct nouveau_fbdev *fbcon = info->par; struct nouveau_fbdev *fbcon = info->par;
struct nouveau_drm *drm = nouveau_drm(fbcon->dev); struct nouveau_drm *drm = nouveau_drm(fbcon->helper.dev);
NV_ERROR(drm, "GPU lockup - switching to software fbcon\n"); NV_ERROR(drm, "GPU lockup - switching to software fbcon\n");
info->flags |= FBINFO_HWACCEL_DISABLED; info->flags |= FBINFO_HWACCEL_DISABLED;
@ -522,7 +522,6 @@ nouveau_fbcon_init(struct drm_device *dev)
if (!fbcon) if (!fbcon)
return -ENOMEM; return -ENOMEM;
fbcon->dev = dev;
drm->fbcon = fbcon; drm->fbcon = fbcon;
drm_fb_helper_prepare(dev, &fbcon->helper, &nouveau_fbcon_helper_funcs); drm_fb_helper_prepare(dev, &fbcon->helper, &nouveau_fbcon_helper_funcs);

View File

@ -34,7 +34,6 @@
struct nouveau_fbdev { struct nouveau_fbdev {
struct drm_fb_helper helper; struct drm_fb_helper helper;
struct nouveau_framebuffer nouveau_fb; struct nouveau_framebuffer nouveau_fb;
struct drm_device *dev;
unsigned int saved_flags; unsigned int saved_flags;
struct nvif_object surf2d; struct nvif_object surf2d;
struct nvif_object clip; struct nvif_object clip;

View File

@ -30,7 +30,7 @@ int
nv04_fbcon_copyarea(struct fb_info *info, const struct fb_copyarea *region) nv04_fbcon_copyarea(struct fb_info *info, const struct fb_copyarea *region)
{ {
struct nouveau_fbdev *nfbdev = info->par; struct nouveau_fbdev *nfbdev = info->par;
struct nouveau_drm *drm = nouveau_drm(nfbdev->dev); struct nouveau_drm *drm = nouveau_drm(nfbdev->helper.dev);
struct nouveau_channel *chan = drm->channel; struct nouveau_channel *chan = drm->channel;
int ret; int ret;
@ -50,7 +50,7 @@ int
nv04_fbcon_fillrect(struct fb_info *info, const struct fb_fillrect *rect) nv04_fbcon_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
{ {
struct nouveau_fbdev *nfbdev = info->par; struct nouveau_fbdev *nfbdev = info->par;
struct nouveau_drm *drm = nouveau_drm(nfbdev->dev); struct nouveau_drm *drm = nouveau_drm(nfbdev->helper.dev);
struct nouveau_channel *chan = drm->channel; struct nouveau_channel *chan = drm->channel;
int ret; int ret;
@ -77,7 +77,7 @@ int
nv04_fbcon_imageblit(struct fb_info *info, const struct fb_image *image) nv04_fbcon_imageblit(struct fb_info *info, const struct fb_image *image)
{ {
struct nouveau_fbdev *nfbdev = info->par; struct nouveau_fbdev *nfbdev = info->par;
struct nouveau_drm *drm = nouveau_drm(nfbdev->dev); struct nouveau_drm *drm = nouveau_drm(nfbdev->helper.dev);
struct nouveau_channel *chan = drm->channel; struct nouveau_channel *chan = drm->channel;
uint32_t fg; uint32_t fg;
uint32_t bg; uint32_t bg;
@ -133,7 +133,7 @@ int
nv04_fbcon_accel_init(struct fb_info *info) nv04_fbcon_accel_init(struct fb_info *info)
{ {
struct nouveau_fbdev *nfbdev = info->par; struct nouveau_fbdev *nfbdev = info->par;
struct drm_device *dev = nfbdev->dev; struct drm_device *dev = nfbdev->helper.dev;
struct nouveau_drm *drm = nouveau_drm(dev); struct nouveau_drm *drm = nouveau_drm(dev);
struct nouveau_channel *chan = drm->channel; struct nouveau_channel *chan = drm->channel;
struct nvif_device *device = &drm->device; struct nvif_device *device = &drm->device;

View File

@ -30,7 +30,7 @@ int
nv50_fbcon_fillrect(struct fb_info *info, const struct fb_fillrect *rect) nv50_fbcon_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
{ {
struct nouveau_fbdev *nfbdev = info->par; struct nouveau_fbdev *nfbdev = info->par;
struct nouveau_drm *drm = nouveau_drm(nfbdev->dev); struct nouveau_drm *drm = nouveau_drm(nfbdev->helper.dev);
struct nouveau_channel *chan = drm->channel; struct nouveau_channel *chan = drm->channel;
int ret; int ret;
@ -65,7 +65,7 @@ int
nv50_fbcon_copyarea(struct fb_info *info, const struct fb_copyarea *region) nv50_fbcon_copyarea(struct fb_info *info, const struct fb_copyarea *region)
{ {
struct nouveau_fbdev *nfbdev = info->par; struct nouveau_fbdev *nfbdev = info->par;
struct nouveau_drm *drm = nouveau_drm(nfbdev->dev); struct nouveau_drm *drm = nouveau_drm(nfbdev->helper.dev);
struct nouveau_channel *chan = drm->channel; struct nouveau_channel *chan = drm->channel;
int ret; int ret;
@ -93,7 +93,7 @@ int
nv50_fbcon_imageblit(struct fb_info *info, const struct fb_image *image) nv50_fbcon_imageblit(struct fb_info *info, const struct fb_image *image)
{ {
struct nouveau_fbdev *nfbdev = info->par; struct nouveau_fbdev *nfbdev = info->par;
struct nouveau_drm *drm = nouveau_drm(nfbdev->dev); struct nouveau_drm *drm = nouveau_drm(nfbdev->helper.dev);
struct nouveau_channel *chan = drm->channel; struct nouveau_channel *chan = drm->channel;
uint32_t dwords, *data = (uint32_t *)image->data; uint32_t dwords, *data = (uint32_t *)image->data;
uint32_t mask = ~(~0 >> (32 - info->var.bits_per_pixel)); uint32_t mask = ~(~0 >> (32 - info->var.bits_per_pixel));
@ -149,7 +149,7 @@ nv50_fbcon_accel_init(struct fb_info *info)
{ {
struct nouveau_fbdev *nfbdev = info->par; struct nouveau_fbdev *nfbdev = info->par;
struct nouveau_framebuffer *fb = &nfbdev->nouveau_fb; struct nouveau_framebuffer *fb = &nfbdev->nouveau_fb;
struct drm_device *dev = nfbdev->dev; struct drm_device *dev = nfbdev->helper.dev;
struct nouveau_drm *drm = nouveau_drm(dev); struct nouveau_drm *drm = nouveau_drm(dev);
struct nouveau_channel *chan = drm->channel; struct nouveau_channel *chan = drm->channel;
int ret, format; int ret, format;

View File

@ -30,7 +30,7 @@ int
nvc0_fbcon_fillrect(struct fb_info *info, const struct fb_fillrect *rect) nvc0_fbcon_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
{ {
struct nouveau_fbdev *nfbdev = info->par; struct nouveau_fbdev *nfbdev = info->par;
struct nouveau_drm *drm = nouveau_drm(nfbdev->dev); struct nouveau_drm *drm = nouveau_drm(nfbdev->helper.dev);
struct nouveau_channel *chan = drm->channel; struct nouveau_channel *chan = drm->channel;
int ret; int ret;
@ -65,7 +65,7 @@ int
nvc0_fbcon_copyarea(struct fb_info *info, const struct fb_copyarea *region) nvc0_fbcon_copyarea(struct fb_info *info, const struct fb_copyarea *region)
{ {
struct nouveau_fbdev *nfbdev = info->par; struct nouveau_fbdev *nfbdev = info->par;
struct nouveau_drm *drm = nouveau_drm(nfbdev->dev); struct nouveau_drm *drm = nouveau_drm(nfbdev->helper.dev);
struct nouveau_channel *chan = drm->channel; struct nouveau_channel *chan = drm->channel;
int ret; int ret;
@ -93,7 +93,7 @@ int
nvc0_fbcon_imageblit(struct fb_info *info, const struct fb_image *image) nvc0_fbcon_imageblit(struct fb_info *info, const struct fb_image *image)
{ {
struct nouveau_fbdev *nfbdev = info->par; struct nouveau_fbdev *nfbdev = info->par;
struct nouveau_drm *drm = nouveau_drm(nfbdev->dev); struct nouveau_drm *drm = nouveau_drm(nfbdev->helper.dev);
struct nouveau_channel *chan = drm->channel; struct nouveau_channel *chan = drm->channel;
uint32_t dwords, *data = (uint32_t *)image->data; uint32_t dwords, *data = (uint32_t *)image->data;
uint32_t mask = ~(~0 >> (32 - info->var.bits_per_pixel)); uint32_t mask = ~(~0 >> (32 - info->var.bits_per_pixel));
@ -148,7 +148,7 @@ int
nvc0_fbcon_accel_init(struct fb_info *info) nvc0_fbcon_accel_init(struct fb_info *info)
{ {
struct nouveau_fbdev *nfbdev = info->par; struct nouveau_fbdev *nfbdev = info->par;
struct drm_device *dev = nfbdev->dev; struct drm_device *dev = nfbdev->helper.dev;
struct nouveau_framebuffer *fb = &nfbdev->nouveau_fb; struct nouveau_framebuffer *fb = &nfbdev->nouveau_fb;
struct nouveau_drm *drm = nouveau_drm(dev); struct nouveau_drm *drm = nouveau_drm(dev);
struct nouveau_channel *chan = drm->channel; struct nouveau_channel *chan = drm->channel;