drm/agpsupport: Code cleanup
Subsystems (2)
v3 cover drm/agpsupport: Code cleanup
Removes checkpath.pl errors and warnings.
Changes in v3:
-Change commit title prefix from drm to drm/agpsupport -Split the commit "Move EXPORT_SYMBOL so that it immediately follows its
function" into two commits. Removing the extra blank line is now a separate commit.
-Included merging conditionals in "Remove assignment in if condition"
in the commit message
Meghana Madhyastha (4):
drm/agpsupport: Replace "foo * bar" with "foo *bar" drm/agpsupport: Remove assignment in if condition drm/agpsupport: Move EXPORT_SYMBOL so that it immediately follows its
function
drm/agpsupport: Remove extra blank line
drivers/gpu/drm/drm_agpsupport.c | 45 ++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 22 deletions(-)
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 1/4 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.
---
Changes in v3:
-None
drivers/gpu/drm/drm_agpsupport.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/drm_agpsupport.c +5 -5
@@ -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;
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 2/4 drm/agpsupport: Remove assignment in if condition
In reply to Meghana MadhyasthaMove 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
---
Changes in v3:
-Added "Merged multiple similar conditionals" to the commit message.
drivers/gpu/drm/drm_agpsupport.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-)
drivers/gpu/drm/drm_agpsupport.c +18 -13
@@ -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 ; }
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 3/4 drm/agpsupport: Move EXPORT_SYMBOL so that it immediately follows its function
In reply to Meghana MadhyasthaEXPORT_SYMBOL(foo) should immediately follow its function/variable. This coding style is preferred.
Found by checkpath.pl.
---
Changes in v3:
-Split this commit into two commits and made another commit for
removing the extra blank line not part of the EXPORT_SYMBOL warning
drivers/gpu/drm/drm_agpsupport.c | 3 --- 1 file changed, 3 deletions(-)
drivers/gpu/drm/drm_agpsupport.c +0 -3
@@ -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,
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 4/4 drm/agpsupport: Remove extra blank line
In reply to Meghana MadhyasthaRemove extra blank line to adhere to standard coding style. Found by checkpath.pl..
---
Changes in v3:
-This was part of another commit in v2 and v1.
Now made this a separate commit
drivers/gpu/drm/drm_agpsupport.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/drm_agpsupport.c +0 -1
@@ -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) {
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [Outreachy kernel] [PATCH v3 4/4] drm/agpsupport: Remove extra blank line
Quoted 17 lines · Meghana Madhyastha
Remove extra blank line to adhere to standard coding style. Found by checkpath.pl..
Signed-off-by Meghana Madhyastha <[email protected]>---
Changes in v3:
-This was part of another commit in v2 and v1.
Now made this a separate commitdrivers/gpu/drm/drm_agpsupport.c | 1 - 1 file changed, 1 deletion(-)drivers/gpu/drm/drm_agpsupport.c +0
-0
drivers/gpu/drm/drm_agpsupport.c int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request) · line 376
Quoted 4 lines
drivers/gpu/drm/drm_agpsupport.c +0
-1@@ -373,7 +373,6 @@ int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request)EXPORT_SYMBOL (drm_agp_free); -
This looks better.
But you got some Reviewed-by: annotations from Sean. You should preserve them on the next version.
julia
Quoted 13 lines
drivers/gpu/drm/drm_agpsupport.c +0
-1int drm_agp_free_ioctl (struct drm_device *dev,void *data,struct drm_file *file_priv) { --2.7.4
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/9cfc7e7535908f3fe3b1df706f2999687c90d4e7.1505376068.git.meghana.madhyastha%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Quoted 10 lines · Meghana Madhyastha
Removes checkpath.pl errors and warnings.
Changes in v3:
-Change commit title prefix from drm to drm/agpsupport -Split the commit "MoveEXPORT_SYMBOLso that it immediately follows its
function" into two commits. Removing the extra blank line is now a separate commit.
-Included merging conditionals in "Remove assignment in if condition"
in the commit message
Quoted 6 lines
Meghana Madhyastha (4):
drm/agpsupport: Replace "foo * bar" with "foo *bar" drm/agpsupport: Remove assignment in if condition drm/agpsupport: MoveEXPORT_SYMBOLso that it immediately follows its
function
drm/agpsupport: Remove extra blank line
Note, I can't do anything with patches that are outside of drivers/staging/ for outreachy submissions. Hopefully the drm developers are ok with this, it's up to them to accept these...
thanks,
greg k-h
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 18 lines · Greg KH
Quoted 10 lines · Meghana Madhyastha
Removes checkpath.pl errors and warnings.
Changes in v3:
-Change commit title prefix from drm to drm/agpsupport -Split the commit "MoveEXPORT_SYMBOLso that it immediately follows its
function" into two commits. Removing the extra blank line is now a separate commit.
-Included merging conditionals in "Remove assignment in if condition"
in the commit messageQuoted 6 lines
Meghana Madhyastha (4):
drm/agpsupport: Replace "foo * bar" with "foo *bar" drm/agpsupport: Remove assignment in if condition drm/agpsupport: MoveEXPORT_SYMBOLso that it immediately follows its
function
drm/agpsupport: Remove extra blank line
Quoted 3 lines
Note, I can't do anything with patches that are outside of
drivers/staging/for outreachy submissions. Hopefully the drm developers are ok with this, it's up to them to accept these...
We'll take care of them.
Thanks,
Jani.
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 10 lines · Meghana Madhyastha
Removes checkpath.pl errors and warnings.
Changes in v3:
-Change commit title prefix from drm to drm/agpsupport -Split the commit "MoveEXPORT_SYMBOLso that it immediately follows its
function" into two commits. Removing the extra blank line is now a separate commit.
-Included merging conditionals in "Remove assignment in if condition"
in the commit message
Quoted 6 lines
Meghana Madhyastha (4):
drm/agpsupport: Replace "foo * bar" with "foo *bar" drm/agpsupport: Remove assignment in if condition drm/agpsupport: MoveEXPORT_SYMBOLso that it immediately follows its
function
drm/agpsupport: Remove extra blank line
Hi Meghana,
Thanks for your patches! I've applied them to drm-misc-next.
Apologies it took a bit longer than it should have to apply them, I've been traveling the past two weeks.
Sean
Quoted 13 lines
drivers/gpu/drm/drm_agpsupport.c | 45 ++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 22 deletions(-)Signature · 8 lines
2.7.4 -- You received this message because you are subscribed to the Google Groups "outreachy-kernel" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/cover.1505376068.git.meghana.madhyastha%40gmail.com. For more options, visit https://groups.google.com/d/optout.
Signature · 5 lines
Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel