* [PATCH v2 0/1] mcb: Use DEFINE_RES_MEM() to simplify code @ 2021-06-16 1:55 Zhen Lei 2021-06-16 1:55 ` [PATCH v2 1/1] " Zhen Lei 0 siblings, 1 reply; 6+ messages in thread From: Zhen Lei @ 2021-06-16 1:55 UTC (permalink / raw) To: Johannes Thumshirn, Greg Kroah-Hartman, linux-kernel; +Cc: Zhen Lei 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(-) -- 2.25.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/1] mcb: Use DEFINE_RES_MEM() to simplify code 2021-06-16 1:55 [PATCH v2 0/1] mcb: Use DEFINE_RES_MEM() to simplify code Zhen Lei @ 2021-06-16 1:55 ` Zhen Lei 2021-06-16 6:41 ` Greg Kroah-Hartman 0 siblings, 1 reply; 6+ messages in thread From: Zhen Lei @ 2021-06-16 1:55 UTC (permalink / raw) To: Johannes Thumshirn, Greg Kroah-Hartman, linux-kernel; +Cc: 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. Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> --- drivers/mcb/mcb-lpc.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/mcb/mcb-lpc.c b/drivers/mcb/mcb-lpc.c index 506676754538..53decd89876e 100644 --- a/drivers/mcb/mcb-lpc.c +++ b/drivers/mcb/mcb-lpc.c @@ -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 = { -- 2.25.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/1] mcb: Use DEFINE_RES_MEM() to simplify code 2021-06-16 1:55 ` [PATCH v2 1/1] " Zhen Lei @ 2021-06-16 6:41 ` Greg Kroah-Hartman 2021-06-16 6:57 ` Leizhen (ThunderTown) 0 siblings, 1 reply; 6+ messages in thread From: Greg Kroah-Hartman @ 2021-06-16 6:41 UTC (permalink / raw) To: Zhen Lei; +Cc: Johannes Thumshirn, linux-kernel On Wed, Jun 16, 2021 at 09:55:09AM +0800, Zhen Lei wrote: > 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/1] mcb: Use DEFINE_RES_MEM() to simplify code 2021-06-16 6:41 ` Greg Kroah-Hartman @ 2021-06-16 6:57 ` Leizhen (ThunderTown) 2021-06-16 7:17 ` Greg Kroah-Hartman 0 siblings, 1 reply; 6+ messages in thread From: Leizhen (ThunderTown) @ 2021-06-16 6:57 UTC (permalink / raw) To: Greg Kroah-Hartman; +Cc: Johannes Thumshirn, linux-kernel On 2021/6/16 14:41, Greg Kroah-Hartman wrote: > On Wed, Jun 16, 2021 at 09:55:09AM +0800, Zhen Lei wrote: >> 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. > > thanks, > > greg k-h > > . > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/1] mcb: Use DEFINE_RES_MEM() to simplify code 2021-06-16 6:57 ` Leizhen (ThunderTown) @ 2021-06-16 7:17 ` Greg Kroah-Hartman 2021-06-16 7:37 ` Leizhen (ThunderTown) 0 siblings, 1 reply; 6+ messages in thread From: Greg Kroah-Hartman @ 2021-06-16 7:17 UTC (permalink / raw) To: Leizhen (ThunderTown); +Cc: Johannes Thumshirn, linux-kernel On Wed, Jun 16, 2021 at 02:57:14PM +0800, Leizhen (ThunderTown) wrote: > > > On 2021/6/16 14:41, Greg Kroah-Hartman wrote: > > On Wed, Jun 16, 2021 at 09:55:09AM +0800, Zhen Lei wrote: > >> 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 this is not a "fix" then that is fine, I can take it as-is, it just was not obvious. greg k-h ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/1] mcb: Use DEFINE_RES_MEM() to simplify code 2021-06-16 7:17 ` Greg Kroah-Hartman @ 2021-06-16 7:37 ` Leizhen (ThunderTown) 0 siblings, 0 replies; 6+ messages in thread From: Leizhen (ThunderTown) @ 2021-06-16 7:37 UTC (permalink / raw) To: Greg Kroah-Hartman; +Cc: Johannes Thumshirn, linux-kernel On 2021/6/16 15:17, Greg Kroah-Hartman wrote: > On Wed, Jun 16, 2021 at 02:57:14PM +0800, Leizhen (ThunderTown) wrote: >> >> >> On 2021/6/16 14:41, Greg Kroah-Hartman wrote: >>> On Wed, Jun 16, 2021 at 09:55:09AM +0800, Zhen Lei wrote: >>>> 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 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. > > greg k-h > > . > ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-06-16 7:37 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-06-16 1:55 [PATCH v2 0/1] mcb: Use DEFINE_RES_MEM() to simplify code Zhen Lei 2021-06-16 1:55 ` [PATCH v2 1/1] " Zhen Lei 2021-06-16 6:41 ` Greg Kroah-Hartman 2021-06-16 6:57 ` Leizhen (ThunderTown) 2021-06-16 7:17 ` Greg Kroah-Hartman 2021-06-16 7:37 ` Leizhen (ThunderTown)
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.