From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-io1-f41.google.com (mail-io1-f41.google.com [209.85.166.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5A96670 for ; Thu, 3 Jun 2021 21:46:02 +0000 (UTC) Received: by mail-io1-f41.google.com with SMTP id a6so7992609ioe.0 for ; Thu, 03 Jun 2021 14:46:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=5hYN0m9fjMChEAS/wXbVHaeLqYj0w+avaFBB2KzbaKQ=; b=tbingU8+EXeEyF9wZOnShTdITV3nEcTvbV9wPe5s2qmfZuZ56hVtJ7K6M3DOK8vu6r eey89xG73gilLhDh4yCr3rP2+jFDtlvIEOpnGKFS2Vfo80iatsLcCCo0Wbak2gpCzTCH ktH8ojegJJAbHZ/k9rOrDdqeNwCOHkpnm8NqulaCWygjMhBgAlX6rz6pFEwYzBh2lg9P VRT7TiyvNJ8eJ2MdvDbaPfRe1cIFKszqMlMLWnE/SSdCLsXU7D4QXD/+xMjVfvKXmLiO j9hCih4r/5JYv3i/EAIy80U50T/QAuQwupGY/EeddV7ePS3WbI59uItt3vi7Neu8fRx/ ODkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=5hYN0m9fjMChEAS/wXbVHaeLqYj0w+avaFBB2KzbaKQ=; b=WbRCUXAYXp/2PaIkrjaNvrBTi7xMsxvWd7Le0DGehmAwnzp0RoGs6iYdNcQbRweaK0 b7+texC9J9Z0vzD/Oh9FWo1lDbzoFa3SpF5cGcqnbjvSo70ADfZP9VAoOQSDFC2l3VH9 VsRZMi5/wh0V9NMIM8/9t/GV50V5yjsWs572nD/rvp43FxpgAqVcMZwGxV1tp3z5oykL NJQOfO24JnjguGUk99mbdG70borlI8e6wrTjAtVBWpEcYz2dAs/5QxTVeB/MhmpsaDI9 WkgvR3DnBU0NVLQOdIyfNIaoVGINZg5Ei8tbsVUS+ufxKeFjWlYZeZskdpO1c3naB2D/ xizQ== X-Gm-Message-State: AOAM530Q1On+f+wCY8p7CeF3cyflnxUxP4SfYzG9zTy6Acl2pKYnao7D F55Ttn5RdZPyTYMlXePhEPBK7Q== X-Google-Smtp-Source: ABdhPJyPsE8yU5GjdLW7Mi8jJ56LaqeAkeazSQlhqSf6mCpOFgtsLuN/A9Wn7lCiX3b3qZssinMOLA== X-Received: by 2002:a6b:3b4c:: with SMTP id i73mr1079942ioa.149.1622756761477; Thu, 03 Jun 2021 14:46:01 -0700 (PDT) Received: from [172.22.22.4] (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.googlemail.com with ESMTPSA id z8sm2234354ioi.38.2021.06.03.14.46.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Jun 2021 14:46:01 -0700 (PDT) Subject: Re: [greybus-dev] [PATCH] staging: greybus: fixed the coding style, labels should not be indented. To: David Laight , 'Manikishan Ghantasala' , Alex Elder Cc: Alex Elder , "greybus-dev@lists.linaro.org" , "linux-staging@lists.linux.dev" , Johan Hovold , "linux-kernel@vger.kernel.org" References: <20210602133659.46158-1-manikishanghantasala@gmail.com> <9a3878fd-3b59-76f5-ddc7-625c66f9fee8@ieee.org> <792dd57c0ef8454497e5ae4c4534dea2@AcuMS.aculab.com> From: Alex Elder Message-ID: Date: Thu, 3 Jun 2021 16:45:59 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 X-Mailing-List: linux-staging@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <792dd57c0ef8454497e5ae4c4534dea2@AcuMS.aculab.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit On 6/3/21 4:22 PM, David Laight wrote: > From: Manikishan Ghantasala >> Sent: 02 June 2021 15:28 >> >> I agree those are called bit-field member names rather than labels. >> But the reason I mentioned is because the ./scripts/checkpatch.pl >> gave out a warning saying "labels should not be indented". >> >> Sorry for the confusion in the name I referred to. So, I think this >> change is needed as I feel this is not following the coding-style by >> having indent before the width for bit field member. I went through >> other places in source code to make sure this is correct, and sent the >> patch after confirmation. >> >> Regards, >> Manikishan Ghantasala >> >> On Wed, 2 Jun 2021 at 19:13, Alex Elder wrote: >>> >>> On 6/2/21 8:36 AM, sh4nnu wrote: >>>> From: Manikishan Ghantasala >>>> >>>> staging: greybus: gpio.c: Clear coding-style problem >>>> "labels should not be indented" by removing indentation. >>> >>> These are not labels. >>> >>> I don't really understand what you're doing here. >>> >>> Can you please explain why you think this needs changing? >>> >>> -Alex >>> >>>> Signed-off-by: Manikishan Ghantasala >>>> --- >>>> drivers/staging/greybus/gpio.c | 6 +++--- >>>> 1 file changed, 3 insertions(+), 3 deletions(-) >>>> >>>> diff --git a/drivers/staging/greybus/gpio.c b/drivers/staging/greybus/gpio.c >>>> index 7e6347fe93f9..4661f4a251bd 100644 >>>> --- a/drivers/staging/greybus/gpio.c >>>> +++ b/drivers/staging/greybus/gpio.c >>>> @@ -20,9 +20,9 @@ >>>> struct gb_gpio_line { >>>> /* The following has to be an array of line_max entries */ >>>> /* --> make them just a flags field */ >>>> - u8 active: 1, >>>> - direction: 1, /* 0 = output, 1 = input */ >>>> - value: 1; /* 0 = low, 1 = high */ >>>> + u8 active:1, >>>> + direction:1, /* 0 = output, 1 = input */ >>>> + value:1; /* 0 = low, 1 = high */ > > Why are you even using bitfields at all? > If you cared about the structure size you'd not have a byte-size pad here. Apparently I committed this, and it was part of the very first Greybus drivers... These would be better defined as Booleans; there are others in the same structure after all. That would have avoided the checkpatch problem in the first place. I was probably thinking *a little* about structure size when defining it this way, but I agree with you, the bit-fields don't really add value. > Since I doubt many copies of this structure get allocated the > (typical) increase in code size for the bitfields will also > exceed any size saving. > > Isn't the kernel style also to repeat the type for every field? I see that style in many places, but not all. I personally like it this way--provided it's done in a way that makes it clear where the integral boundaries are. -Alex > David > > >>>> u16 debounce_usec; >>>> >>>> u8 irq_type; >>>> >>> > > - > Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK > Registration No: 1397386 (Wales) > _______________________________________________ > greybus-dev mailing list > greybus-dev@lists.linaro.org > https://lists.linaro.org/mailman/listinfo/greybus-dev >