Re: [PATCH V2] lib/scatterlist: Add SG_CHAIN and SG_END macros for LSB encodings

From: Andy Shevchenko
Date: Mon Feb 19 2018 - 07:25:51 EST


On Mon, Feb 19, 2018 at 12:10 PM, Tvrtko Ursulin <tursulin@xxxxxxxxxxx> wrote:
> On 19/02/18 04:12, Anshuman Khandual wrote:
>> On 02/18/2018 12:58 AM, kbuild test robot wrote:


>>> #define SG_END 0x02
>>> In file included from include/linux/blkdev.h:28:0,
>>> from drivers/staging/rts5208/rtsx.c:23:
>>> include/linux/scatterlist.h:69:0: note: this is the location of the
>>> previous definition
>>> #define SG_END 0x02UL
>>>
>>> vim +/SG_END +343 drivers/staging/rts5208/rtsx_chip.h
>>
>>
>> SG_END is already defined in a driver.

In some driver which is by the way staging one.

> Hence shall we change back
>> 'SG_END' definition as 'SG_EMARK' or any other suggestions ?
>
>
> Maybe SG_LAST? Going by existence of sg_is_chain and sg_is_last.

The mentioned driver should be cleaned up as well (and perhaps to start with).
It allows us to rectify constants in global namespace.

So, from my point of view the driver code is ugly in a sense it
doesn't have its own namespace for constants.

After we fix the driver, the rest would be whatever we get agreed on.

> And also would probably be good to add something like:
>
> #define SG_PAGE_BITS (SG_CHAIN | SG_LAST)
> #define SG_PAGE_MASK (~SG_PAGE_BITS)
>
> ?

Good suggestion,

--
With Best Regards,
Andy Shevchenko