From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751042AbdAQIVv (ORCPT ); Tue, 17 Jan 2017 03:21:51 -0500 Received: from smtprelay0113.hostedemail.com ([216.40.44.113]:49043 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750863AbdAQIV3 (ORCPT ); Tue, 17 Jan 2017 03:21:29 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 50,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::::::::,RULES_HIT:41:69:152:355:379:421:541:599:800:960:967:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:2393:2525:2560:2563:2682:2685:2827:2859:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3355:3622:3865:3867:3868:3870:3871:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4250:4321:4605:5007:9025:10004:10400:10848:11026:11232:11233:11473:11658:11914:12043:12048:12296:12438:12683:12740:12895:13161:13229:13894:14096:14097:14181:14659:14721:21080:21451:30046:30054:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:4,LUA_SUMMARY:none X-HE-Tag: club03_2988cabe0d131 X-Filterd-Recvd-Size: 3851 Message-ID: <1484641283.9538.5.camel@perches.com> Subject: Re: [PATCH v2 6+/6] platform/x86: dell-wmi-led: fix coding style issues From: Joe Perches To: =?UTF-8?Q?Micha=C5=82_K=C4=99pie=C5=84?= , Richard Purdie , Jacek Anaszewski , Pavel Machek , Pali =?ISO-8859-1?Q?Roh=E1r?= , Darren Hart , Jaroslav Kysela , Takashi Iwai Cc: Andy Shevchenko , Anthony Wong , linux-leds@vger.kernel.org, platform-driver-x86@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Date: Tue, 17 Jan 2017 00:21:23 -0800 In-Reply-To: <20170117071714.21594-1-kernel@kempniu.pl> References: <20170116132204.6421-1-kernel@kempniu.pl> <20170117071714.21594-1-kernel@kempniu.pl> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.3-0ubuntu0.1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2017-01-17 at 08:17 +0100, Michał Kępień wrote: > Fix coding style issues in dell-wmi-led which checkpatch complains about > to make sure the module gets a clean start in the x86 platform driver > subsystem. trivia: > Signed-off-by: Michał Kępień > --- > This is an extra patch that Jacek asked for [1]. > > [1] https://lkml.org/lkml/2017/1/16/631 > > drivers/platform/x86/dell-wmi-led.c | 41 +++++++++++++++---------------------- > 1 file changed, 16 insertions(+), 25 deletions(-) > > diff --git a/drivers/platform/x86/dell-wmi-led.c b/drivers/platform/x86/dell-wmi-led.c [] > @@ -46,21 +46,16 @@ struct bios_args { > unsigned char off_time; > }; > > -static int dell_led_perform_fn(u8 length, > - u8 result_code, > - u8 device_id, > - u8 command, > - u8 on_time, > - u8 off_time) > +static int dell_led_perform_fn(u8 length, u8 result_code, u8 device_id, > + u8 command, u8 on_time, u8 off_time) > { > - struct bios_args *bios_return; > - u8 return_code; > - union acpi_object *obj; > struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL }; > + struct bios_args *bios_return, args; > struct acpi_buffer input; > + union acpi_object *obj; > acpi_status status; > + u8 return_code; > > - struct bios_args args; > args.length = length; > args.result_code = result_code; > args.device_id = device_id; This declaration might be nicer using struct bios_args args = { .length = length, .result_code = result_code, .device_id = device_id, [...] }; [] > @@ -138,24 +128,25 @@ static void dell_led_set(struct led_classdev *led_cdev, > } > > static int dell_led_blink(struct led_classdev *led_cdev, > - unsigned long *delay_on, > - unsigned long *delay_off) > + unsigned long *delay_on, unsigned long *delay_off) > { > unsigned long on_eighths; > unsigned long off_eighths; > > - /* The Dell LED delay is based on 125ms intervals. > - Need to round up to next interval. */ > + /* > + * The Dell LED delay is based on 125ms intervals. > + * Need to round up to next interval. > + */ > > on_eighths = (*delay_on + 124) / 125; > - if (0 == on_eighths) > + if (on_eighths == 0) > on_eighths = 1; > if (on_eighths > 255) > on_eighths = 255; > *delay_on = on_eighths * 125; > > off_eighths = (*delay_off + 124) / 125; > - if (0 == off_eighths) > + if (off_eighths == 0) > off_eighths = 1; > if (off_eighths > 255) > off_eighths = 255; These could use DIV_ROUND_UP and clamp()