From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752768AbdJTQHc (ORCPT ); Fri, 20 Oct 2017 12:07:32 -0400 Received: from mga03.intel.com ([134.134.136.65]:48913 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752022AbdJTQHb (ORCPT ); Fri, 20 Oct 2017 12:07:31 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,405,1503385200"; d="scan'208";a="911964769" Date: Fri, 20 Oct 2017 21:41:48 +0530 From: Vinod Koul To: Takashi Iwai Cc: Greg Kroah-Hartman , LKML , ALSA , Mark , Pierre , Sanyog Kale , Shreyas NC , patches.audio@intel.com, alan@linux.intel.com, Charles Keepax , Sagar Dharia , srinivas.kandagatla@linaro.org, plai@codeaurora.org, Sudheer Papothi Subject: Re: [PATCH 02/14] soundwire: Add SoundWire bus type Message-ID: <20171020161148.GV30097@localhost> References: <1508382211-3154-1-git-send-email-vinod.koul@intel.com> <1508382211-3154-3-git-send-email-vinod.koul@intel.com> <20171020051101.GG30097@localhost> <20171020154649.GP30097@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 20, 2017 at 05:50:57PM +0200, Takashi Iwai wrote: > On Fri, 20 Oct 2017 17:46:49 +0200, > Vinod Koul wrote: > > > > > > --- a/include/linux/mod_devicetable.h > > > > > > +++ b/include/linux/mod_devicetable.h > > > > > > @@ -228,6 +228,13 @@ struct hda_device_id { > > > > > > unsigned long driver_data; > > > > > > }; > > > > > > > > > > > > +struct sdw_device_id { > > > > > > + __u16 mfg_id; > > > > > > + __u16 part_id; > > > > > > + __u8 class_id; > > > > > > + kernel_ulong_t driver_data; > > > > > > > > > > Better to think of alignment. > > > > > > > > sorry not quite clear, do you mind elaborating which ones to align? > > > > > > kernel_ulong_t may be aligned to 4 or 8 bytes, depending on > > > architecture, so there can be a hole between class_id and driver_data. > > > It's not an ABI, so we don't have to care too much, but it's still > > > something exposed, hence better to be conscious about alignment. > > > > ah :) is that why hda is unsigned long :) Btw doesnt that cause compat > > issues, should we not do something like u64 here? > > Oh, don't take the HD-audio case as a good reference, it's a bad guy > ;) In the case of hda, the definition isn't really exposed. Not really it is for ext-hda codecs > The alignment doesn't matter whether it's unsigned long or > kernel_ulong_t. It's a generic issue when you define some struct and > expose it. In a safer side, you can put the enough pad bytes so that > the long field is aligned in 8 bytes. Or use packed struct. Or you > can just ignore and let it be so, but aware of the possible holes in > your code. that makes sense, I can add some reserved fields for padding here to fix and retain the kernel_ulong_t then -- ~Vinod