Re: [PATCH 1/1] staging: android: ashmem: convert range macros to inlines and clean-up

2016-12-06 Thread Guillaume Tucker
On 12/06/16 07:39, Greg Kroah-Hartman wrote:
> On Mon, Dec 05, 2016 at 08:01:35PM +, Guillaume Tucker wrote:
>> On 12/05/16 18:08, Greg Kroah-Hartman wrote:
>>> On Mon, Dec 05, 2016 at 05:34:15PM +, Guillaume Tucker wrote:
 Convert ashmem_range related macros to inline functions to fix
 checkpatch errors.  Clean up the code in related existing inline
 functions.
>>>
>>> How about breaking this up into two different patches, one for the
>>> inlines, and one to fix up the existing inline functions for coding
>>> style issues?
>>>
>>> thanks,
>>>
>>> greg k-h
>>
>> Sure, thanks.  I've sent a v2.
>>
>> (and sorry the series still doesn't seem to be treated as a thread in
>> spite of the In-Reply-To: and References: headers being there...)
> 
> They are there, but they are incorrect, are you using git send-email to
> set them, or are you trying to do it by hand?

I was using 'git format-patch --thread' and 'git imap-send' to
upload them to my gmail drafts and then send them with my email
client (Icedove in this case).  It looks like it all worked
except for the Message-IDs, they got rewritten somehow.  I'll
either find a way to fix it or use plain 'git send-email' to get
this sorted before I send any more patches.

Thanks!

Guillaume
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/1] staging: android: ashmem: convert range macros to inlines and clean-up

2016-12-05 Thread Greg Kroah-Hartman
On Mon, Dec 05, 2016 at 08:01:35PM +, Guillaume Tucker wrote:
> On 12/05/16 18:08, Greg Kroah-Hartman wrote:
> > On Mon, Dec 05, 2016 at 05:34:15PM +, Guillaume Tucker wrote:
> >> Convert ashmem_range related macros to inline functions to fix
> >> checkpatch errors.  Clean up the code in related existing inline
> >> functions.
> > 
> > How about breaking this up into two different patches, one for the
> > inlines, and one to fix up the existing inline functions for coding
> > style issues?
> > 
> > thanks,
> > 
> > greg k-h
> 
> Sure, thanks.  I've sent a v2.
> 
> (and sorry the series still doesn't seem to be treated as a thread in
> spite of the In-Reply-To: and References: headers being there...)

They are there, but they are incorrect, are you using git send-email to
set them, or are you trying to do it by hand?

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/1] staging: android: ashmem: convert range macros to inlines and clean-up

2016-12-05 Thread Guillaume Tucker
On 12/05/16 18:08, Greg Kroah-Hartman wrote:
> On Mon, Dec 05, 2016 at 05:34:15PM +, Guillaume Tucker wrote:
>> Convert ashmem_range related macros to inline functions to fix
>> checkpatch errors.  Clean up the code in related existing inline
>> functions.
> 
> How about breaking this up into two different patches, one for the
> inlines, and one to fix up the existing inline functions for coding
> style issues?
> 
> thanks,
> 
> greg k-h

Sure, thanks.  I've sent a v2.

(and sorry the series still doesn't seem to be treated as a thread in
spite of the In-Reply-To: and References: headers being there...)

Cheers,
Guillaume
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/1] staging: android: ashmem: convert range macros to inlines and clean-up

2016-12-05 Thread Greg Kroah-Hartman
On Mon, Dec 05, 2016 at 05:34:15PM +, Guillaume Tucker wrote:
> Convert ashmem_range related macros to inline functions to fix
> checkpatch errors.  Clean up the code in related existing inline
> functions.

How about breaking this up into two different patches, one for the
inlines, and one to fix up the existing inline functions for coding
style issues?

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/1] staging: android: ashmem: convert range macros to inlines and clean-up

2016-12-05 Thread Guillaume Tucker
Convert ashmem_range related macros to inline functions to fix
checkpatch errors.  Clean up the code in related existing inline
functions.

Signed-off-by: Guillaume Tucker 
---
 drivers/staging/android/ashmem.c | 40 ++--
 1 file changed, 22 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c
index ca9a53c..7cbad0d 100644
--- a/drivers/staging/android/ashmem.c
+++ b/drivers/staging/android/ashmem.c
@@ -100,39 +100,43 @@ static DEFINE_MUTEX(ashmem_mutex);
 static struct kmem_cache *ashmem_area_cachep __read_mostly;
 static struct kmem_cache *ashmem_range_cachep __read_mostly;
 
-#define range_size(range) \
-   ((range)->pgend - (range)->pgstart + 1)
+static inline unsigned long range_size(struct ashmem_range *range)
+{
+   return range->pgend - range->pgstart + 1;
+}
 
-#define range_on_lru(range) \
-   ((range)->purged == ASHMEM_NOT_PURGED)
+static inline bool range_on_lru(struct ashmem_range *range)
+{
+   return range->purged == ASHMEM_NOT_PURGED;
+}
 
-static inline int page_range_subsumes_range(struct ashmem_range *range,
-   size_t start, size_t end)
+static inline bool page_range_subsumes_range(struct ashmem_range *range,
+size_t start, size_t end)
 {
-   return (((range)->pgstart >= (start)) && ((range)->pgend <= (end)));
+   return (range->pgstart >= start) && (range->pgend <= end);
 }
 
-static inline int page_range_subsumed_by_range(struct ashmem_range *range,
-  size_t start, size_t end)
+static inline bool page_range_subsumed_by_range(struct ashmem_range *range,
+   size_t start, size_t end)
 {
-   return (((range)->pgstart <= (start)) && ((range)->pgend >= (end)));
+   return (range->pgstart <= start) && (range->pgend >= end);
 }
 
-static inline int page_in_range(struct ashmem_range *range, size_t page)
+static inline bool page_in_range(struct ashmem_range *range, size_t page)
 {
-   return (((range)->pgstart <= (page)) && ((range)->pgend >= (page)));
+   return (range->pgstart <= page) && (range->pgend >= page);
 }
 
-static inline int page_range_in_range(struct ashmem_range *range,
- size_t start, size_t end)
+static inline bool page_range_in_range(struct ashmem_range *range,
+  size_t start, size_t end)
 {
-   return (page_in_range(range, start) || page_in_range(range, end) ||
-   page_range_subsumes_range(range, start, end));
+   return page_in_range(range, start) || page_in_range(range, end) ||
+   page_range_subsumes_range(range, start, end);
 }
 
-static inline int range_before_page(struct ashmem_range *range, size_t page)
+static inline bool range_before_page(struct ashmem_range *range, size_t page)
 {
-   return ((range)->pgend < (page));
+   return range->pgend < page;
 }
 
 #define PROT_MASK  (PROT_EXEC | PROT_READ | PROT_WRITE)
-- 
2.8.1.116.g7b0d47b

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel