From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E22BC433E5 for ; Tue, 23 Mar 2021 17:31:06 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1F692619B7 for ; Tue, 23 Mar 2021 17:31:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1F692619B7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id AB9E41674; Tue, 23 Mar 2021 18:30:13 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz AB9E41674 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1616520663; bh=+gkdT//QflthiNbXPYtxoN8uVztwAbSr7AGVbSihGVc=; h=Subject:To:References:From:Date:In-Reply-To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=SvFB+qhmXk5gY0Bw20drqdtuaxoX9NnZKZrky7jp7ei7r54PXqOzq07jURgIPDy6N A/cjqZ3AtrumGdyEjv4QX/RfZqOMYtYVTFnNUn/sYSfJx6rx1h13CySNDa/tlZJuPR N+mvh/OGDvm+2SbE0BNbCepMN6UEVx8Q8kobtotU= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id F08AFF8026D; Tue, 23 Mar 2021 18:30:11 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 0E858F80279; Tue, 23 Mar 2021 18:30:09 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id C63C3F80155 for ; Tue, 23 Mar 2021 18:29:53 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C63C3F80155 IronPort-SDR: RdBMRvqS5mopejtxe3UTXmuu+wxbQpKatVtSB3PC87T5E7sIUdVAa7riz8ryrafSBlRVoOM1je nD7aW3rHtOGw== X-IronPort-AV: E=McAfee;i="6000,8403,9932"; a="187209824" X-IronPort-AV: E=Sophos;i="5.81,272,1610438400"; d="scan'208";a="187209824" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2021 10:29:51 -0700 IronPort-SDR: WRJgxqZXlzflkb8puAOEADTdOczI+anSWdWdPzjNlpSvtCeaTxVLKBpJ8VESbf4Pp4AtC8D5UO WSfCxPgUecPg== X-IronPort-AV: E=Sophos;i="5.81,272,1610438400"; d="scan'208";a="452236263" Received: from laguitie-mobl.amr.corp.intel.com (HELO [10.252.129.185]) ([10.252.129.185]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2021 10:29:49 -0700 Subject: Re: [PATCH] soundwire: intel: move to auxiliary bus To: Greg KH , Vinod Koul References: <20210323004325.19727-1-yung-chuan.liao@linux.intel.com> From: Pierre-Louis Bossart Message-ID: Date: Tue, 23 Mar 2021 12:29:48 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, hui.wang@canonical.com, srinivas.kandagatla@linaro.org, sanyog.r.kale@intel.com, Bard Liao , rander.wang@linux.intel.com, bard.liao@intel.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Thanks Greg and Vinod for the reviews >>> -static int intel_master_probe(struct platform_device *pdev) >>> +static int intel_link_probe(struct auxiliary_device *auxdev, const struct auxiliary_device_id *id) >>> { >>> - struct device *dev = &pdev->dev; >>> + struct device *dev = &auxdev->dev; >>> + struct sdw_intel_link_dev *ldev = auxiliary_dev_to_sdw_intel_link_dev(auxdev); >> >> Do we need another abstractions for resources here, why not aux dev >> creation set the resources required and we skip this step... Not sure what resources you are referring to? this is just a container_of() and the documented way of extending the auxbus (see https://www.kernel.org/doc/html/latest/driver-api/auxiliary_bus.html#example-usage) struct sdw_intel_link_dev { struct auxiliary_device auxdev; struct sdw_intel_link_res link_res; }; #define auxiliary_dev_to_sdw_intel_link_dev(auxiliary_dev) \ container_of(auxiliary_dev, struct sdw_intel_link_dev, auxdev) >>> struct sdw_intel *sdw; >>> struct sdw_cdns *cdns; >>> struct sdw_bus *bus; >>> @@ -1346,14 +1347,14 @@ static int intel_master_probe(struct platform_device *pdev) >>> cdns = &sdw->cdns; >>> bus = &cdns->bus; >>> >>> - sdw->instance = pdev->id; >>> - sdw->link_res = dev_get_platdata(dev); >>> + sdw->instance = auxdev->id; >> >> so auxdev has id and still we pass id as argument :( Not sure if folks >> can fix this now > > That's odd, yeah, it should be fixed. I think we are talking about different things? this is defined in mod_devicetable.h: struct auxiliary_device_id { char name[AUXILIARY_NAME_SIZE]; kernel_ulong_t driver_data; }; and used for the driver probe: ret = auxdrv->probe(auxdev, auxiliary_match_id(auxdrv->id_table, auxdev)); but there is a separate id: struct auxiliary_device { struct device dev; const char *name; u32 id; }; which is set during the device initialization in intel_init.c /* we don't use an IDA since we already have a link ID */ auxdev->id = link_id; In the auxiliary bus design, the parent has to take care of managing this id, be it with an IDA or as we do here with a physical link ID that is unique. in short, I don't see how I could change the code given the differences in concepts?