Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp51782pxf; Wed, 24 Mar 2021 20:43:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHEPLITetJPM1BSt6Q7gl6QFTZwQdn8Vx5WUfDy6GmE4KXMhd8EPtlZrbzk5iczJ+MTuau X-Received: by 2002:a17:906:1c13:: with SMTP id k19mr7138452ejg.457.1616643780904; Wed, 24 Mar 2021 20:43:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616643780; cv=none; d=google.com; s=arc-20160816; b=s0p7063FNZLVtwxbHNWkzsVUZK3/V2+fwt1eq9BnCBd4dUXcpA8EsXH+uCoH6DID6X U1Mz9U24nVLrIIslU0VKJsLG96NgxosXvUn0qP3KA1oQXOWMc5jLjYzuYecIzk/LeC8S WuLsYBLTC13uc8GOBh13xzAxZkqLLgecb61N6z9zUNqWA1f/pcwYOZNHxlDlcR69LzYL H4pwM4qR56HR3PrJo8QJa6RVKPn2iqpwPVJ5YAy8o7Mp0M0qumTRFLtBtqEOPVwy5CIT GrTJpbMeB8s7q6yQLwlBt7MOZUqAp+pK0/D54TOKABGHFDPMj0QTMtIkvfpFDJY+0ph7 Q7rA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=LxNp4uKcpyxZbSUnZ0cRMEr26HQKVGN+A894UY2C1Y0=; b=biKfKrs5UsfLKh9glvkebkVdovb1HV0RM7LZpWYWFfhfNW0EBUKZlevo7CmHGQrFKm pLvkTP1/GfCd8wZ0N3vm7PrBQLAwxwUKtw6r4eLTtDMa+X0ueXfUoD7vXadQ42zAqcrh OAPsz7D4/4I3dt+T1GqLhPa+agfmDDBEJpBeSfC3iFkkVcMuElddrDPkuyfTSiLqvLxe E1dOFNgS/lEDEy2w71KL7FQl/lW4r8lqic48TiZI0VSRF3bT0cIaSLT8rNSOT82HFN1w C0nt8mq6onZ1t5wXHlz5VzSGNpLIS3u3Q2Vag7ciPvavHySQ9E41PhWv3/JR+xQqQYfC yDBg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e1si2843003edr.103.2021.03.24.20.42.39; Wed, 24 Mar 2021 20:43:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239783AbhCYB1j (ORCPT + 99 others); Wed, 24 Mar 2021 21:27:39 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:14578 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239810AbhCYB1F (ORCPT ); Wed, 24 Mar 2021 21:27:05 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4F5S8H1ySPz19H57; Thu, 25 Mar 2021 09:25:03 +0800 (CST) Received: from [127.0.0.1] (10.40.192.162) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.498.0; Thu, 25 Mar 2021 09:26:57 +0800 Subject: Re: [PATCH] ACPI: AC: fix some errors and warnings reported by checkpatch.pl To: "Rafael J. Wysocki" References: <1616504247-48744-1-git-send-email-tanxiaofei@huawei.com> CC: "Rafael J. Wysocki" , Len Brown , "ACPI Devel Maling List" , Linux Kernel Mailing List , From: Xiaofei Tan Message-ID: <3d663f6a-69d7-56db-fa4d-593c7e7857f8@huawei.com> Date: Thu, 25 Mar 2021 09:26:57 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.40.192.162] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Rafael, On 2021/3/24 23:57, Rafael J. Wysocki wrote: > On Tue, Mar 23, 2021 at 2:01 PM Xiaofei Tan wrote: >> >> Fix some errors and warnings reported by checkpatch.pl, including >> following five types: > > Well, they are coding style issues rather than errors. > Right, i could change the description. >> ERROR: "foo * bar" should be "foo *bar" >> ERROR: code indent should use tabs where possible >> WARNING: Block comments use a trailing */ on a separate line >> WARNING: braces {} are not necessary for single statement blocks >> WARNING: void function return statements are not generally useful >> >> Signed-off-by: Xiaofei Tan >> --- >> drivers/acpi/ac.c | 32 +++++++++++++------------------- >> 1 file changed, 13 insertions(+), 19 deletions(-) >> >> diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c >> index b86ee6e..07987854 100644 >> --- a/drivers/acpi/ac.c >> +++ b/drivers/acpi/ac.c >> @@ -78,17 +78,16 @@ static struct acpi_driver acpi_ac_driver = { >> struct acpi_ac { >> struct power_supply *charger; >> struct power_supply_desc charger_desc; >> - struct acpi_device * device; >> + struct acpi_device *device; >> unsigned long long state; >> struct notifier_block battery_nb; >> }; >> >> #define to_acpi_ac(x) power_supply_get_drvdata(x) >> >> -/* -------------------------------------------------------------------------- >> - AC Adapter Management >> - -------------------------------------------------------------------------- */ >> - >> +/* >> + * AC Adapter Management >> + */ > > Please use the /* ... */ (one-line) comment format here and below for > comments that aren't longer than one line. > Sure. >> static int acpi_ac_get_state(struct acpi_ac *ac) >> { >> acpi_status status = AE_OK; >> @@ -109,9 +108,9 @@ static int acpi_ac_get_state(struct acpi_ac *ac) >> return 0; >> } >> >> -/* -------------------------------------------------------------------------- >> - sysfs I/F >> - -------------------------------------------------------------------------- */ >> +/* >> + * sysfs I/F >> + */ >> static int get_ac_property(struct power_supply *psy, >> enum power_supply_property psp, >> union power_supply_propval *val) >> @@ -138,10 +137,9 @@ static enum power_supply_property ac_props[] = { >> POWER_SUPPLY_PROP_ONLINE, >> }; >> >> -/* -------------------------------------------------------------------------- >> - Driver Model >> - -------------------------------------------------------------------------- */ >> - >> +/* >> + * Driver Model >> + */ >> static void acpi_ac_notify(struct acpi_device *device, u32 event) >> { >> struct acpi_ac *ac = acpi_driver_data(device); >> @@ -174,8 +172,6 @@ static void acpi_ac_notify(struct acpi_device *device, u32 event) >> acpi_notifier_call_chain(device, event, (u32) ac->state); >> kobject_uevent(&ac->charger->dev.kobj, KOBJ_CHANGE); >> } >> - >> - return; >> } >> >> static int acpi_ac_battery_notify(struct notifier_block *nb, >> @@ -282,9 +278,8 @@ static int acpi_ac_add(struct acpi_device *device) >> ac->battery_nb.notifier_call = acpi_ac_battery_notify; >> register_acpi_notifier(&ac->battery_nb); >> end: >> - if (result) { >> + if (result) >> kfree(ac); >> - } >> >> return result; >> } >> @@ -293,7 +288,7 @@ static int acpi_ac_add(struct acpi_device *device) >> static int acpi_ac_resume(struct device *dev) >> { >> struct acpi_ac *ac; >> - unsigned old_state; >> + unsigned int old_state; >> >> if (!dev) >> return -EINVAL; >> @@ -352,9 +347,8 @@ static int __init acpi_ac_init(void) >> } >> >> result = acpi_bus_register_driver(&acpi_ac_driver); >> - if (result < 0) { >> + if (result < 0) >> return -ENODEV; >> - } >> >> return 0; >> } >> -- > > . >