Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751754AbbEZUZr (ORCPT ); Tue, 26 May 2015 16:25:47 -0400 Received: from mail-wi0-f172.google.com ([209.85.212.172]:33434 "EHLO mail-wi0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751154AbbEZUZq (ORCPT ); Tue, 26 May 2015 16:25:46 -0400 Message-ID: <5564D6C6.9040400@gmail.com> Date: Tue, 26 May 2015 22:25:42 +0200 From: Mateusz Kulikowski User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Dan Carpenter CC: gregkh@linuxfoundation.org, joe@perches.com, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 02/35] staging: rtl8192e: Declare ethernet addresses as __aligned(2) References: <1432223628-1664-1-git-send-email-mateusz.kulikowski@gmail.com> <1432223628-1664-3-git-send-email-mateusz.kulikowski@gmail.com> <20150525135319.GA11588@mwanda> In-Reply-To: <20150525135319.GA11588@mwanda> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2277 Lines: 58 On 25.05.2015 15:53, Dan Carpenter wrote: > On Thu, May 21, 2015 at 05:53:15PM +0200, Mateusz Kulikowski wrote: >> Add __aligned(2) into ethernet addresses allocated on stack or in non-packed >> structures. Use ETH_ALEN as array length in places where it was hardcoded to 6. > > To be honest, this patch makes me hate the stupid ether_addr_copy() > checkpatch warnings even more than I hated it before. Do we really need > to add __aligned(2) to everything? Is there no other option which isn't > as horrible? > > We could introduce a new typedef: > > typedef struct { > char addr[6] __aligned(2); > } eth_addr_t; > > Introducing a new kind of type is maybe a bit much just to make > checkpatch.pl happy but so is putting __aligned(2) everywhere. True. I was a bit overzealous here with __aligned(2) and assumed someone will break it by accident. Proposal for v5: I'll verify alignment of each array, and reorder variables where possible/needed to keep the alignment. Then I'll hopefully drop this patch. > Or maybe we could make a new ether_addr_copy() implementation that uses > preprocessor macros and chooses the right kind of implementation? I'm not sure it can be handled compile time for generic case. > >> diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c >> index aad5cc9..9c6dc82 100644 >> --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c >> +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c >> @@ -321,7 +321,9 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) >> u8 ICVer8192, ICVer8256; >> u16 i, usValue, IC_Version; >> u16 EEPROMId; >> - u8 bMac_Tmp_Addr[6] = {0x00, 0xe0, 0x4c, 0x00, 0x00, 0x01}; >> + static const u8 bMac_Tmp_Addr[ETH_ALEN] __aligned(2) = { >> + 0x00, 0xe0, 0x4c, 0x00, 0x00, 0x01 >> + }; > > What's up with the whacky indenting? It was proposal from Joe; perhaps breaking 80-column line would be even better in that case (for sure will be once I remove __aligned) Regards, Mateusz -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/