From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752266AbdJTPvB (ORCPT ); Fri, 20 Oct 2017 11:51:01 -0400 Received: from mx2.suse.de ([195.135.220.15]:57425 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751018AbdJTPvA (ORCPT ); Fri, 20 Oct 2017 11:51:00 -0400 Date: Fri, 20 Oct 2017 17:50:57 +0200 Message-ID: From: Takashi Iwai To: Vinod Koul 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 In-Reply-To: <20171020154649.GP30097@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> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 20 Oct 2017 17:46:49 +0200, Vinod Koul wrote: > > On Fri, Oct 20, 2017 at 08:59:42AM +0200, Takashi Iwai wrote: > > On Fri, 20 Oct 2017 07:11:01 +0200, > > Vinod Koul wrote: > > > > > > On Thu, Oct 19, 2017 at 09:40:06AM +0200, Takashi Iwai wrote: > > > > On Thu, 19 Oct 2017 05:03:18 +0200, > > > > Vinod Koul wrote: > > > > > + > > > > > +config SOUNDWIRE_BUS > > > > > + tristate > > > > > + default SOUNDWIRE > > > > > + > > > > > > > > Does it make sense to be tristate? > > > > Since CONFIG_SOUNDWIRE is a bool, the above would be also only either > > > > Y or N. If it's Y and others select M, it'll be still Y. > > > > > > hmmm good point. I think would make sense to make SOUNDWIRE as tristate too, > > > just like SOUND :) > > > > It's one option. Another would be to simply drop the "default" line. > > Okay good suggestion > > > > > > + * The match is done by comparing the mfg_id and part_id from the > > > > > + * struct sdw_device_id. class_id is unused, as it is a placeholder > > > > > + * in MIPI Spec. > > > > > + */ > > > > > +static const struct sdw_device_id * > > > > > +sdw_get_device_id(struct sdw_slave *slave, struct sdw_driver *drv) > > > > > +{ > > > > > + const struct sdw_device_id *id = drv->id_table; > > > > > + > > > > > + while (id && id->mfg_id) { > > > > > + if (slave->id.mfg_id == id->mfg_id && > > > > > + slave->id.part_id == id->part_id) { > > > > > > > > Please indentation properly. > > > > > > what do you advise? > > > > > > if (slave->id.mfg_id == id->mfg_id && > > > slave->id.part_id == id->part_id) { > > > > > > would mean below one is at same indent. Some people use: > > > > > > if (slave->id.mfg_id == id->mfg_id && > > > slave->id.part_id == id->part_id) { > > > > > > Is it Documented anywhere... > > > > This is a matter of taste. The latter is the way Emacs or indent does > > as default. > > okay as vi user I will try to do above :) > > > > > > > > --- 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. 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. Takashi