From e3cbeaf8db3dc0b2cfd3c31dfac5bec8846d33f2 Mon Sep 17 00:00:00 2001 From: Meghana Madhyastha Date: Thu, 14 Sep 2017 13:39:14 +0530 Subject: drm/agpsupport: Replace "foo * bar" with "foo *bar" This replaces all instances of foo * bar with foo *bar in drm_agpsupport.c. This is so that it adheres to standard C syntax for pointers. Signed-off-by: Meghana Madhyastha Signed-off-by: Sean Paul Link: https://patchwork.freedesktop.org/patch/msgid/e092694c26e61fc6147e44851392a43b7a68c4f3.1505376068.git.meghana.madhyastha@gmail.com --- drivers/gpu/drm/drm_agpsupport.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers/gpu/drm/drm_agpsupport.c') diff --git a/drivers/gpu/drm/drm_agpsupport.c b/drivers/gpu/drm/drm_agpsupport.c index c89953449e96..d9e8cdd4b9e9 100644 --- a/drivers/gpu/drm/drm_agpsupport.c +++ b/drivers/gpu/drm/drm_agpsupport.c @@ -95,7 +95,7 @@ int drm_agp_info_ioctl(struct drm_device *dev, void *data, * Verifies the AGP device hasn't been acquired before and calls * \c agp_backend_acquire. */ -int drm_agp_acquire(struct drm_device * dev) +int drm_agp_acquire(struct drm_device *dev) { if (!dev->agp) return -ENODEV; @@ -135,7 +135,7 @@ int drm_agp_acquire_ioctl(struct drm_device *dev, void *data, * * Verifies the AGP device has been acquired and calls \c agp_backend_release. */ -int drm_agp_release(struct drm_device * dev) +int drm_agp_release(struct drm_device *dev) { if (!dev->agp || !dev->agp->acquired) return -EINVAL; @@ -161,7 +161,7 @@ int drm_agp_release_ioctl(struct drm_device *dev, void *data, * Verifies the AGP device has been acquired but not enabled, and calls * \c agp_enable. */ -int drm_agp_enable(struct drm_device * dev, struct drm_agp_mode mode) +int drm_agp_enable(struct drm_device *dev, struct drm_agp_mode mode) { if (!dev->agp || !dev->agp->acquired) return -EINVAL; @@ -244,8 +244,8 @@ int drm_agp_alloc_ioctl(struct drm_device *dev, void *data, * * Walks through drm_agp_head::memory until finding a matching handle. */ -static struct drm_agp_mem *drm_agp_lookup_entry(struct drm_device * dev, - unsigned long handle) +static struct drm_agp_mem *drm_agp_lookup_entry(struct drm_device *dev, + unsigned long handle) { struct drm_agp_mem *entry; -- cgit v1.2.3-55-g7522 From 182e61d136bd1f927e33bf4a98d1f7ebedbeba2d Mon Sep 17 00:00:00 2001 From: Meghana Madhyastha Date: Thu, 14 Sep 2017 13:40:49 +0530 Subject: drm/agpsupport: Remove assignment in if condition Move the assignment so that it happens before the if condition. Merged multiple similar conditionals to a single conditional statement. This results in syntax which is easier to read. Found by checkpath.pl Signed-off-by: Meghana Madhyastha Signed-off-by: Sean Paul Link: https://patchwork.freedesktop.org/patch/msgid/d30cb59d92c8a98d0665ef6ae2a56b364dc61098.1505376068.git.meghana.madhyastha@gmail.com --- drivers/gpu/drm/drm_agpsupport.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'drivers/gpu/drm/drm_agpsupport.c') diff --git a/drivers/gpu/drm/drm_agpsupport.c b/drivers/gpu/drm/drm_agpsupport.c index d9e8cdd4b9e9..860d57acb8e3 100644 --- a/drivers/gpu/drm/drm_agpsupport.c +++ b/drivers/gpu/drm/drm_agpsupport.c @@ -101,7 +101,8 @@ int drm_agp_acquire(struct drm_device *dev) return -ENODEV; if (dev->agp->acquired) return -EBUSY; - if (!(dev->agp->bridge = agp_backend_acquire(dev->pdev))) + dev->agp->bridge = agp_backend_acquire(dev->pdev); + if (!dev->agp->bridge) return -ENODEV; dev->agp->acquired = 1; return 0; @@ -203,12 +204,14 @@ int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request) if (!dev->agp || !dev->agp->acquired) return -EINVAL; - if (!(entry = kzalloc(sizeof(*entry), GFP_KERNEL))) + entry = kzalloc(sizeof(*entry), GFP_KERNEL); + if (!entry) return -ENOMEM; pages = (request->size + PAGE_SIZE - 1) / PAGE_SIZE; type = (u32) request->type; - if (!(memory = agp_allocate_memory(dev->agp->bridge, pages, type))) { + memory = agp_allocate_memory(dev->agp->bridge, pages, type); + if (!memory) { kfree(entry); return -ENOMEM; } @@ -275,9 +278,8 @@ int drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request) if (!dev->agp || !dev->agp->acquired) return -EINVAL; - if (!(entry = drm_agp_lookup_entry(dev, request->handle))) - return -EINVAL; - if (!entry->bound) + entry = drm_agp_lookup_entry(dev, request->handle); + if (!entry || !entry->bound) return -EINVAL; ret = drm_unbind_agp(entry->memory); if (ret == 0) @@ -316,12 +318,12 @@ int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request) if (!dev->agp || !dev->agp->acquired) return -EINVAL; - if (!(entry = drm_agp_lookup_entry(dev, request->handle))) - return -EINVAL; - if (entry->bound) + entry = drm_agp_lookup_entry(dev, request->handle); + if (!entry || entry->bound) return -EINVAL; page = (request->offset + PAGE_SIZE - 1) / PAGE_SIZE; - if ((retcode = drm_bind_agp(entry->memory, page))) + retcode = drm_bind_agp(entry->memory, page); + if (retcode) return retcode; entry->bound = dev->agp->base + (page << PAGE_SHIFT); DRM_DEBUG("base = 0x%lx entry->bound = 0x%lx\n", @@ -359,7 +361,8 @@ int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request) if (!dev->agp || !dev->agp->acquired) return -EINVAL; - if (!(entry = drm_agp_lookup_entry(dev, request->handle))) + entry = drm_agp_lookup_entry(dev, request->handle); + if (!entry) return -EINVAL; if (entry->bound) drm_unbind_agp(entry->memory); @@ -398,11 +401,13 @@ struct drm_agp_head *drm_agp_init(struct drm_device *dev) { struct drm_agp_head *head = NULL; - if (!(head = kzalloc(sizeof(*head), GFP_KERNEL))) + head = kzalloc(sizeof(*head), GFP_KERNEL); + if (!head) return NULL; head->bridge = agp_find_bridge(dev->pdev); if (!head->bridge) { - if (!(head->bridge = agp_backend_acquire(dev->pdev))) { + head->bridge = agp_backend_acquire(dev->pdev); + if (!head->bridge) { kfree(head); return NULL; } -- cgit v1.2.3-55-g7522 From 221399c387cd85ea552f7fbc8c219a6927b430ec Mon Sep 17 00:00:00 2001 From: Meghana Madhyastha Date: Thu, 14 Sep 2017 13:43:12 +0530 Subject: drm/agpsupport: Move EXPORT_SYMBOL so that it immediately follows its function EXPORT_SYMBOL(foo) should immediately follow its function/variable. This coding style is preferred. Found by checkpath.pl. Signed-off-by: Meghana Madhyastha Signed-off-by: Sean Paul Link: https://patchwork.freedesktop.org/patch/msgid/0496f0e821082969ec7950ac35f1e6b6cedb22a6.1505376068.git.meghana.madhyastha@gmail.com --- drivers/gpu/drm/drm_agpsupport.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'drivers/gpu/drm/drm_agpsupport.c') diff --git a/drivers/gpu/drm/drm_agpsupport.c b/drivers/gpu/drm/drm_agpsupport.c index 860d57acb8e3..a0510557787c 100644 --- a/drivers/gpu/drm/drm_agpsupport.c +++ b/drivers/gpu/drm/drm_agpsupport.c @@ -70,7 +70,6 @@ int drm_agp_info(struct drm_device *dev, struct drm_agp_info *info) return 0; } - EXPORT_SYMBOL(drm_agp_info); int drm_agp_info_ioctl(struct drm_device *dev, void *data, @@ -107,7 +106,6 @@ int drm_agp_acquire(struct drm_device *dev) dev->agp->acquired = 1; return 0; } - EXPORT_SYMBOL(drm_agp_acquire); /** @@ -172,7 +170,6 @@ int drm_agp_enable(struct drm_device *dev, struct drm_agp_mode mode) dev->agp->enabled = 1; return 0; } - EXPORT_SYMBOL(drm_agp_enable); int drm_agp_enable_ioctl(struct drm_device *dev, void *data, -- cgit v1.2.3-55-g7522 From 13cc80ce4404e19619c41fc636ebb2dd91a22c23 Mon Sep 17 00:00:00 2001 From: Meghana Madhyastha Date: Thu, 14 Sep 2017 13:44:20 +0530 Subject: drm/agpsupport: Remove extra blank line Remove extra blank line to adhere to standard coding style. Found by checkpath.pl.. Signed-off-by: Meghana Madhyastha Signed-off-by: Sean Paul Link: https://patchwork.freedesktop.org/patch/msgid/9cfc7e7535908f3fe3b1df706f2999687c90d4e7.1505376068.git.meghana.madhyastha@gmail.com --- drivers/gpu/drm/drm_agpsupport.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/gpu/drm/drm_agpsupport.c') diff --git a/drivers/gpu/drm/drm_agpsupport.c b/drivers/gpu/drm/drm_agpsupport.c index a0510557787c..737f02885c28 100644 --- a/drivers/gpu/drm/drm_agpsupport.c +++ b/drivers/gpu/drm/drm_agpsupport.c @@ -373,7 +373,6 @@ int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request) EXPORT_SYMBOL(drm_agp_free); - int drm_agp_free_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv) { -- cgit v1.2.3-55-g7522