Linux-HyperV List
 help / color / mirror / Atom feed
From: Matheus Castello <matheus@castello.eng.br>
To: Michael Kelley <mikelley@microsoft.com>
Cc: "sashal@kernel.org" <sashal@kernel.org>,
	Tianyu Lan <Tianyu.Lan@microsoft.com>,
	Dexuan Cui <decui@microsoft.com>,
	Sunil Muthuswamy <sunilmut@microsoft.com>,
	"linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	KY Srinivasan <kys@microsoft.com>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	"wei.liu@kernel.org" <wei.liu@kernel.org>,
	Stephen Hemminger <sthemmin@microsoft.com>
Subject: Re: [PATCH 4/6] drivers: hv: vmbus: Fix checkpatch SPLIT_STRING
Date: Tue, 24 Nov 2020 21:54:29 -0300	[thread overview]
Message-ID: <ada0ef93-1443-49a0-914c-1ad03ffa024b@castello.eng.br> (raw)
In-Reply-To: <MW2PR2101MB1052B329DFC5D54F4D7501E9D7E40@MW2PR2101MB1052.namprd21.prod.outlook.com>

Hi Michael,

Em 11/15/2020 7:25 PM, Michael Kelley escreveu:
> From: Matheus Castello <matheus@castello.eng.br> Sent: Sunday, November 15, 2020 11:58 AM
>>
>> Checkpatch emits WARNING: quoted string split across lines.
>> To keep the code clean and with the 80 column length indentation the
>> check and registration code for kmsg_dump_register has been transferred
>> to a new function hv_kmsg_dump_register.
>>
>> Signed-off-by: Matheus Castello <matheus@castello.eng.br>
>> ---
>>   drivers/hv/vmbus_drv.c | 34 +++++++++++++++++++---------------
>>   1 file changed, 19 insertions(+), 15 deletions(-)
>>
>> diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
>> index 61d28c743263..09d8236a51cf 100644
>> --- a/drivers/hv/vmbus_drv.c
>> +++ b/drivers/hv/vmbus_drv.c
>> @@ -1387,6 +1387,23 @@ static struct kmsg_dumper hv_kmsg_dumper = {
>>   	.dump = hv_kmsg_dump,
>>   };
>>
>> +static void hv_kmsg_dump_register(void)
>> +{
>> +	int ret;
>> +
>> +	hv_panic_page = (void *)hv_alloc_hyperv_zeroed_page();
>> +	if (hv_panic_page) {
>> +		ret = kmsg_dump_register(&hv_kmsg_dumper);
>> +		if (ret) {
>> +			pr_err("Hyper-V: kmsg dump register error 0x%x\n", ret);
>> +			hv_free_hyperv_page((unsigned long)hv_panic_page);
>> +			hv_panic_page = NULL;
>> +		}
>> +	} else {
>> +		pr_err("Hyper-V: panic message page memory allocation failed");
>> +	}
>> +}
>> +
> 
> The above would be marginally better if organized as follows so that the
> main execution path isn't in an "if" clause.  Also reduces indentation.
> 
> 	hv_panic_page = (void *)hv_alloc_hyperv_zeroed_page();
> 	if (!hv_panic_page) {
> 		pr_err("Hyper-V: panic message page memory allocation failed");
> 		return;
> 	}
> 	ret = kmsg_dump_register(&hv_kmsg_dumper);
> 	if (ret) {
> 		pr_err("Hyper-V: kmsg dump register error 0x%x\n", ret);
> 		hv_free_hyperv_page((unsigned long)hv_panic_page);
> 		hv_panic_page = NULL;
> 	}
> 
> 

Thanks for the review, great I will use it on the v2.

>>   static struct ctl_table_header *hv_ctl_table_hdr;
>>
>>   /*
>> @@ -1477,21 +1494,8 @@ static int vmbus_bus_init(void)
>>   		 * capability is supported by the hypervisor.
>>   		 */
>>   		hv_get_crash_ctl(hyperv_crash_ctl);
>> -		if (hyperv_crash_ctl & HV_CRASH_CTL_CRASH_NOTIFY_MSG) {
>> -			hv_panic_page = (void *)hv_alloc_hyperv_zeroed_page();
>> -			if (hv_panic_page) {
>> -				ret = kmsg_dump_register(&hv_kmsg_dumper);
>> -				if (ret) {
>> -					pr_err("Hyper-V: kmsg dump register "
>> -						"error 0x%x\n", ret);
>> -					hv_free_hyperv_page(
>> -					    (unsigned long)hv_panic_page);
>> -					hv_panic_page = NULL;
>> -				}
>> -			} else
>> -				pr_err("Hyper-V: panic message page memory "
>> -					"allocation failed");
>> -		}
>> +		if (hyperv_crash_ctl & HV_CRASH_CTL_CRASH_NOTIFY_MSG)
>> +			hv_kmsg_dump_register();
>>
>>   		register_die_notifier(&hyperv_die_block);
>>   	}
>> --
>> 2.28.0
> 

  reply	other threads:[~2020-11-25  1:42 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-15 19:57 [PATCH 0/6] Add improvements suggested by checkpatch for vmbus_drv Matheus Castello
2020-11-15 19:57 ` [PATCH 1/6] drivers: hv: Fix hyperv_record_panic_msg path on comment Matheus Castello
2020-11-15 22:11   ` Michael Kelley
2020-11-15 19:57 ` [PATCH 2/6] drivers: hv: vmbus: Replace symbolic permissions by octal permissions Matheus Castello
2020-11-15 22:15   ` Michael Kelley
2020-11-15 19:57 ` [PATCH 3/6] drivers: hv: vmbus: Fix checkpatch LINE_SPACING Matheus Castello
2020-11-15 22:16   ` Michael Kelley
2020-11-15 19:57 ` [PATCH 4/6] drivers: hv: vmbus: Fix checkpatch SPLIT_STRING Matheus Castello
2020-11-15 22:25   ` Michael Kelley
2020-11-25  0:54     ` Matheus Castello [this message]
2020-11-25  2:56       ` Joe Perches
2020-11-25  3:14         ` Matheus Castello
2020-11-15 19:57 ` [PATCH 5/6] drivers: hv: vmbus: Fix unnecessary OOM_MESSAGE Matheus Castello
2020-11-16 11:21   ` Wei Liu
2020-11-16 15:58     ` Wei Liu
2020-11-15 19:57 ` [PATCH 6/6] drivers: hv: vmbus: Fix call msleep using < 20ms Matheus Castello
2020-11-15 22:32   ` Michael Kelley
2020-11-17 10:58 ` [PATCH 0/6] Add improvements suggested by checkpatch for vmbus_drv Wei Liu
2020-11-25  0:53   ` Matheus Castello

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ada0ef93-1443-49a0-914c-1ad03ffa024b@castello.eng.br \
    --to=matheus@castello.eng.br \
    --cc=Tianyu.Lan@microsoft.com \
    --cc=decui@microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikelley@microsoft.com \
    --cc=sashal@kernel.org \
    --cc=sthemmin@microsoft.com \
    --cc=sunilmut@microsoft.com \
    --cc=wei.liu@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox