On Wed, May 6, 2020 at 9:48 AM Thomas Zimmermann <tzimmermann@xxxxxxx> wrote: > > Hi > > Am 05.05.20 um 16:09 schrieb Daniel Vetter: > > On Tue, May 05, 2020 at 11:56:47AM +0200, Thomas Zimmermann wrote: > >> Done in preparation of embedding the DRM device in struct mga_device. > >> > >> Signed-off-by: Thomas Zimmermann <tzimmermann@xxxxxxx> > > > > Not exactly sure what the goal is, since mga_vga_init still uses > > drm_device and not the mdev struct. *shrug* > > It replaces 'mdev->dev' with simply 'dev'. That makes patch 5 easier to > read. Ah right, maybe spell that out a bit clearer so that dense people like me get it. You explained it in the commit message, it simply didn't click that this is about avoiding tons of s/mdev->dev/mdev.dev/ replacement noise. -Daniel > > Best regards > Thomas > > > > > Reviewed-by: Daniel Vetter <daniel.vetter@xxxxxxxx> > > > > > >> --- > >> drivers/gpu/drm/mgag200/mgag200_main.c | 21 +++++++++++---------- > >> drivers/gpu/drm/mgag200/mgag200_mode.c | 17 +++++++++-------- > >> 2 files changed, 20 insertions(+), 18 deletions(-) > >> > >> diff --git a/drivers/gpu/drm/mgag200/mgag200_main.c b/drivers/gpu/drm/mgag200/mgag200_main.c > >> index 3830d3f3c9fa2..010b309c01fc4 100644 > >> --- a/drivers/gpu/drm/mgag200/mgag200_main.c > >> +++ b/drivers/gpu/drm/mgag200/mgag200_main.c > >> @@ -66,25 +66,26 @@ static int mga_probe_vram(struct mga_device *mdev, void __iomem *mem) > >> /* Map the framebuffer from the card and configure the core */ > >> static int mga_vram_init(struct mga_device *mdev) > >> { > >> + struct drm_device *dev = mdev->dev; > >> void __iomem *mem; > >> > >> /* BAR 0 is VRAM */ > >> - mdev->mc.vram_base = pci_resource_start(mdev->dev->pdev, 0); > >> - mdev->mc.vram_window = pci_resource_len(mdev->dev->pdev, 0); > >> + mdev->mc.vram_base = pci_resource_start(dev->pdev, 0); > >> + mdev->mc.vram_window = pci_resource_len(dev->pdev, 0); > >> > >> - if (!devm_request_mem_region(mdev->dev->dev, mdev->mc.vram_base, mdev->mc.vram_window, > >> - "mgadrmfb_vram")) { > >> + if (!devm_request_mem_region(dev->dev, mdev->mc.vram_base, > >> + mdev->mc.vram_window, "mgadrmfb_vram")) { > >> DRM_ERROR("can't reserve VRAM\n"); > >> return -ENXIO; > >> } > >> > >> - mem = pci_iomap(mdev->dev->pdev, 0, 0); > >> + mem = pci_iomap(dev->pdev, 0, 0); > >> if (!mem) > >> return -ENOMEM; > >> > >> mdev->mc.vram_size = mga_probe_vram(mdev, mem); > >> > >> - pci_iounmap(mdev->dev->pdev, mem); > >> + pci_iounmap(dev->pdev, mem); > >> > >> return 0; > >> } > >> @@ -116,11 +117,11 @@ int mgag200_driver_load(struct drm_device *dev, unsigned long flags) > >> mdev->has_sdram = !(option & (1 << 14)); > >> > >> /* BAR 0 is the framebuffer, BAR 1 contains registers */ > >> - mdev->rmmio_base = pci_resource_start(mdev->dev->pdev, 1); > >> - mdev->rmmio_size = pci_resource_len(mdev->dev->pdev, 1); > >> + mdev->rmmio_base = pci_resource_start(dev->pdev, 1); > >> + mdev->rmmio_size = pci_resource_len(dev->pdev, 1); > >> > >> - if (!devm_request_mem_region(mdev->dev->dev, mdev->rmmio_base, mdev->rmmio_size, > >> - "mgadrmfb_mmio")) { > >> + if (!devm_request_mem_region(dev->dev, mdev->rmmio_base, > >> + mdev->rmmio_size, "mgadrmfb_mmio")) { > >> drm_err(dev, "can't reserve mmio registers\n"); > >> return -ENOMEM; > >> } > >> diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c > >> index fa91869c0db52..aaa73b29b04f0 100644 > >> --- a/drivers/gpu/drm/mgag200/mgag200_mode.c > >> +++ b/drivers/gpu/drm/mgag200/mgag200_mode.c > >> @@ -1433,6 +1433,7 @@ static const struct drm_crtc_helper_funcs mga_helper_funcs = { > >> /* CRTC setup */ > >> static void mga_crtc_init(struct mga_device *mdev) > >> { > >> + struct drm_device *dev = mdev->dev; > >> struct mga_crtc *mga_crtc; > >> > >> mga_crtc = kzalloc(sizeof(struct mga_crtc) + > >> @@ -1442,7 +1443,7 @@ static void mga_crtc_init(struct mga_device *mdev) > >> if (mga_crtc == NULL) > >> return; > >> > >> - drm_crtc_init(mdev->dev, &mga_crtc->base, &mga_crtc_funcs); > >> + drm_crtc_init(dev, &mga_crtc->base, &mga_crtc_funcs); > >> > >> drm_mode_crtc_set_gamma_size(&mga_crtc->base, MGAG200_LUT_SIZE); > >> mdev->mode_info.crtc = mga_crtc; > >> @@ -1617,30 +1618,30 @@ static struct drm_connector *mga_vga_init(struct drm_device *dev) > >> > >> int mgag200_modeset_init(struct mga_device *mdev) > >> { > >> + struct drm_device *dev = mdev->dev; > >> struct drm_encoder *encoder = &mdev->encoder; > >> struct drm_connector *connector; > >> int ret; > >> > >> mdev->mode_info.mode_config_initialized = true; > >> > >> - mdev->dev->mode_config.max_width = MGAG200_MAX_FB_WIDTH; > >> - mdev->dev->mode_config.max_height = MGAG200_MAX_FB_HEIGHT; > >> + dev->mode_config.max_width = MGAG200_MAX_FB_WIDTH; > >> + dev->mode_config.max_height = MGAG200_MAX_FB_HEIGHT; > >> > >> - mdev->dev->mode_config.fb_base = mdev->mc.vram_base; > >> + dev->mode_config.fb_base = mdev->mc.vram_base; > >> > >> mga_crtc_init(mdev); > >> > >> - ret = drm_simple_encoder_init(mdev->dev, encoder, > >> - DRM_MODE_ENCODER_DAC); > >> + ret = drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_DAC); > >> if (ret) { > >> - drm_err(mdev->dev, > >> + drm_err(dev, > >> "drm_simple_encoder_init() failed, error %d\n", > >> ret); > >> return ret; > >> } > >> encoder->possible_crtcs = 0x1; > >> > >> - connector = mga_vga_init(mdev->dev); > >> + connector = mga_vga_init(dev); > >> if (!connector) { > >> DRM_ERROR("mga_vga_init failed\n"); > >> return -1; > >> -- > >> 2.26.0 > >> > > > > -- > Thomas Zimmermann > Graphics Driver Developer > SUSE Software Solutions Germany GmbH > Maxfeldstr. 5, 90409 Nürnberg, Germany > (HRB 36809, AG Nürnberg) > Geschäftsführer: Felix Imendörffer > -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel