diff options
author | Joonyoung Shim <jy0922.shim@samsung.com> | 2011-08-04 01:41:01 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2011-08-04 09:39:21 -0400 |
commit | 5037f8acf448dd0de9868dc7410f45879d3d1a1b (patch) | |
tree | b437939f0fa2c0207bbc0100ebea3ef93d63d276 | |
parent | e1c44acc8cabda6b38864f25e809b306c4d2d790 (diff) |
drm: Add NULL check about irq functions
The struct drm_driver has some function pointers for irq. They are
gpu specific and some functions aren't essential things. This can
prevents creation of unnecessary dummy function for irq.
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r-- | drivers/gpu/drm/drm_irq.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index 9be574fbcc2f..3830e9e478c0 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c | |||
@@ -291,11 +291,14 @@ static void drm_irq_vgaarb_nokms(void *cookie, bool state) | |||
291 | if (!dev->irq_enabled) | 291 | if (!dev->irq_enabled) |
292 | return; | 292 | return; |
293 | 293 | ||
294 | if (state) | 294 | if (state) { |
295 | dev->driver->irq_uninstall(dev); | 295 | if (dev->driver->irq_uninstall) |
296 | else { | 296 | dev->driver->irq_uninstall(dev); |
297 | dev->driver->irq_preinstall(dev); | 297 | } else { |
298 | dev->driver->irq_postinstall(dev); | 298 | if (dev->driver->irq_preinstall) |
299 | dev->driver->irq_preinstall(dev); | ||
300 | if (dev->driver->irq_postinstall) | ||
301 | dev->driver->irq_postinstall(dev); | ||
299 | } | 302 | } |
300 | } | 303 | } |
301 | 304 | ||
@@ -338,7 +341,8 @@ int drm_irq_install(struct drm_device *dev) | |||
338 | DRM_DEBUG("irq=%d\n", drm_dev_to_irq(dev)); | 341 | DRM_DEBUG("irq=%d\n", drm_dev_to_irq(dev)); |
339 | 342 | ||
340 | /* Before installing handler */ | 343 | /* Before installing handler */ |
341 | dev->driver->irq_preinstall(dev); | 344 | if (dev->driver->irq_preinstall) |
345 | dev->driver->irq_preinstall(dev); | ||
342 | 346 | ||
343 | /* Install handler */ | 347 | /* Install handler */ |
344 | if (drm_core_check_feature(dev, DRIVER_IRQ_SHARED)) | 348 | if (drm_core_check_feature(dev, DRIVER_IRQ_SHARED)) |
@@ -363,7 +367,9 @@ int drm_irq_install(struct drm_device *dev) | |||
363 | vga_client_register(dev->pdev, (void *)dev, drm_irq_vgaarb_nokms, NULL); | 367 | vga_client_register(dev->pdev, (void *)dev, drm_irq_vgaarb_nokms, NULL); |
364 | 368 | ||
365 | /* After installing handler */ | 369 | /* After installing handler */ |
366 | ret = dev->driver->irq_postinstall(dev); | 370 | if (dev->driver->irq_postinstall) |
371 | ret = dev->driver->irq_postinstall(dev); | ||
372 | |||
367 | if (ret < 0) { | 373 | if (ret < 0) { |
368 | mutex_lock(&dev->struct_mutex); | 374 | mutex_lock(&dev->struct_mutex); |
369 | dev->irq_enabled = 0; | 375 | dev->irq_enabled = 0; |
@@ -416,7 +422,8 @@ int drm_irq_uninstall(struct drm_device *dev) | |||
416 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) | 422 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) |
417 | vga_client_register(dev->pdev, NULL, NULL, NULL); | 423 | vga_client_register(dev->pdev, NULL, NULL, NULL); |
418 | 424 | ||
419 | dev->driver->irq_uninstall(dev); | 425 | if (dev->driver->irq_uninstall) |
426 | dev->driver->irq_uninstall(dev); | ||
420 | 427 | ||
421 | free_irq(drm_dev_to_irq(dev), dev); | 428 | free_irq(drm_dev_to_irq(dev), dev); |
422 | 429 | ||