mcb: Use DEFINE_RES_MEM() to simplify code
v2 cover mcb: Use DEFINE_RES_MEM() to simplify code
v1 --> v2:
Update commit message.
Zhen Lei (1):
mcb: Use DEFINE_RES_MEM() to simplify code
drivers/mcb/mcb-lpc.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-)
Signature · 1 line
2.25.1
PATCH v2 1/1 mcb: Use DEFINE_RES_MEM() to simplify code
Use DEFINE_RES_MEM() to save a couple of lines of code, which makes the code a bit shorter and easier to read. The start address does not need to appear twice.
By the way, the value of '.end' should be "start + size - 1". So the previous writing should have omitted subtracted 1.
--- drivers/mcb/mcb-lpc.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-)
drivers/mcb/mcb-lpc.c +2 -11
@@ -105,17 +105,8 @@ static int mcb_lpc_create_platform_device(const struct dmi_system_id *id)return ret; } -static struct resource sc24_fpga_resource = { - .start =0xe000e000 , - .end =0xe000e000 +CHAM_HEADER_SIZE , - .flags =IORESOURCE_MEM , -}; - -static struct resource sc31_fpga_resource = { - .start =0xf000e000 , - .end =0xf000e000 +CHAM_HEADER_SIZE , - .flags =IORESOURCE_MEM , -}; +static struct resource sc24_fpga_resource =DEFINE_RES_MEM (0xe000e000 ,CHAM_HEADER_SIZE ); +static struct resource sc31_fpga_resource =DEFINE_RES_MEM (0xf000e000 ,CHAM_HEADER_SIZE );static struct platform_driver mcb_lpc_driver = { .driver = {
Signature · 1 line
2.25.1
Quoted 6 lines · Zhen Lei
Use
DEFINE_RES_MEM()to save a couple of lines of code, which makes the code a bit shorter and easier to read. The start address does not need to appear twice.By the way, the value of '.end' should be "start + size - 1". So the previous writing should have omitted subtracted 1.
Does that mean the current code is wrong and this is a bugfix? If so, what commit id does this fix?
thanks,
greg k-h
Quoted 10 lines · Greg Kroah-Hartman
Quoted 6 lines · Zhen Lei
Use
DEFINE_RES_MEM()to save a couple of lines of code, which makes the code a bit shorter and easier to read. The start address does not need to appear twice.By the way, the value of '.end' should be "start + size - 1". So the previous writing should have omitted subtracted 1.
Does that mean the current code is wrong and this is a bugfix? If so, what commit id does this fix?
OK, I'll add Fixes.
However, some people think that only functional fixes need to add "Fixes".
If "Fixes" were added, I'd have to change the subject, too.
Quoted 7 lines
thanks,
greg k-h
.
Quoted 11 lines · Leizhen (ThunderTown)
Quoted 8 lines · Greg Kroah-Hartman
Quoted 6 lines · Zhen Lei
Use
DEFINE_RES_MEM()to save a couple of lines of code, which makes the code a bit shorter and easier to read. The start address does not need to appear twice.By the way, the value of '.end' should be "start + size - 1". So the previous writing should have omitted subtracted 1.
Quoted 6 lines
Quoted 2 lines
Does that mean the current code is wrong and this is a bugfix? If so, what commit id does this fix?
OK, I'll add Fixes.
However, some people think that only functional fixes need to add "Fixes".
If this is not a "fix" then that is fine, I can take it as-is, it just was not obvious.
greg k-h
Quoted 15 lines · Greg Kroah-Hartman
Quoted 14 lines · Leizhen (ThunderTown)
Quoted 10 lines · Greg Kroah-Hartman
Quoted 6 lines · Zhen Lei
Use
DEFINE_RES_MEM()to save a couple of lines of code, which makes the code a bit shorter and easier to read. The start address does not need to appear twice.By the way, the value of '.end' should be "start + size - 1". So the previous writing should have omitted subtracted 1.
Does that mean the current code is wrong and this is a bugfix? If so, what commit id does this fix?
Quoted 6 lines
Quoted 3 lines
OK, I'll add Fixes.
However, some people think that only functional fixes need to add "Fixes".
If this is not a "fix" then that is fine, I can take it as-is, it just was not obvious.
Sorry, I didn't read the email in time. I just post v3.
Yes, this patch just avoids wasting a bit of memory. There's no need to go to an earlier version.
Quoted 5 lines
greg k-h
.