Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2588654rdb; Wed, 4 Oct 2023 06:03:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGNDiinlEuqk/ppghz8RsCeoE+5dzV/aac5V0j+/z0JQwWMgqF0XflIxQYZrXBR8yczoWPL X-Received: by 2002:a17:902:d4c4:b0:1c3:3dae:5869 with SMTP id o4-20020a170902d4c400b001c33dae5869mr2557518plg.63.1696424617487; Wed, 04 Oct 2023 06:03:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696424617; cv=none; d=google.com; s=arc-20160816; b=pyS6vaa0dAfKhkt74QsfVyBj16eCwwVwJvmE/gv8jcv+22xuZSltnF3azWg4GXUNV+ wV9SUBwdR2DIkczAAGuu8ZRit7IkRJWI3KFXfg3+gvBO1jSPaursmgkiOGGy5aOWoS4E TCadsvN89up2EHTu8qh5GfCDDhU/7ARhBGfSuZCkoyzlWaoACqyTXaguGsQxfibVdOVZ kzX7SdupaGmR4DxCJyf4F+9xQYiQT8ij7ugYWpWeJ2vCWwG5UA01Cmi/4byaVQ1LdBEG aRBjfNCAVN/QQd/bmkmJl2aSI+Qa4wexSY2jx9ovpWOYUgd5L09XIsIS3PIpbhuvy+az gZQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=ZcFoJma4HsSRYQOjS15Jla4T5NRg0e9bZhu1IrMhFVc=; fh=dS7N2SdfTTEBvjc0pAlTTh7Jjh35Wl4vfCuxffMZMFQ=; b=SKfRqXS07u2JvdIISjt2x7FiCmfn3vocQd4GP7iIv6HVZwJEcAEIsIujcR7bpvI/Kn bbc104n6oXDnGXfnOZm/88O7T7PCMiWLvTfob974gIM93zK3IdBt7zFiK/x7GhWVWkrE ndSD2hXpp50jkmRG05dhP0uyRp9O5qv1+NZl/srEsS107rPH4XKDKgkFfz+roVt8JUOp Bl4GCqxO4mslWRdNjUyBZ3AB+OwLigoX7jC3xKt2kleOa2OmHDTGue+Oiz+3qh6hkzbB OFPe86jaHuokgwcY9rgeCsq2EJJ/8/zkVyCOI/mHf2YltN6DXtosU78po23BzgA2Wm4v Xa1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aaCWuzyO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id e9-20020a170902cf4900b001b8c824e826si3492675plg.533.2023.10.04.06.03.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 06:03:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aaCWuzyO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 164578266531; Wed, 4 Oct 2023 06:03:24 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233096AbjJDNDQ (ORCPT + 99 others); Wed, 4 Oct 2023 09:03:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242435AbjJDNDN (ORCPT ); Wed, 4 Oct 2023 09:03:13 -0400 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00A48A9 for ; Wed, 4 Oct 2023 06:03:09 -0700 (PDT) Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-5334f9a56f6so3725391a12.3 for ; Wed, 04 Oct 2023 06:03:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696424588; x=1697029388; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=ZcFoJma4HsSRYQOjS15Jla4T5NRg0e9bZhu1IrMhFVc=; b=aaCWuzyOZxe+RtqvWMFQfIvrGXvM/QDTocmx+ZsGmVLyucaprZlBp88UwLqclK0UEG dBjKJD4zX0laVAGduXD/MN45ySGZbcjJiOdy8f56mJamW8R46SYS+zPv5dlci6AYeWYM 2t+Fafr/KKC1HEHrv2tgnWXUMuDBAAlLMqJ5QB7z6ibJIQQMLdyMI9pv/p7ssokLV7p3 1KKIwqEkK8SiDgsoGEuZnw9GSeRqcf3XjW6f7d50q+DC6sT2GOx3BOewzso4xtwjuUde ZTdKcpZy+6f2VhV6qEBdGHMZluPAxl9J251X/2i0uvjsVT70Wel3rMUVHyZppU9xb9l3 82HA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696424588; x=1697029388; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ZcFoJma4HsSRYQOjS15Jla4T5NRg0e9bZhu1IrMhFVc=; b=PUZe6CI1DSKdbJI/9qSBqDL4ZracfyfbeS6O+GY67t32Erg1avTP/vmya982EvP+57 6SSv8m83RBm7ALEMXaEDMh90uwSTyvL+KN2jxpBqRArM92VQUwz50/AwistTVNSLfrNO yMAln8MlZKKfTif0Z/ASuLnoQpXHJrgm7tem9gzsfngKOFFeuo62yo1A1g7jBQ0e1Tni /NnwJAGQmZdbgavVvbto+e2c8fcQCdeV0K0+Hr+yKnwhcAr2BjMweyYAdTzNa04o+nUe 4ryekAg2NVqZajXAHobo4iC9FgI2kTlPGANBH7U40A57Fd4Icu5jQ1dG80D7nYZnkeTo JpaA== X-Gm-Message-State: AOJu0Yz4lkuJn0pMLMVtZ+BPkINiyWTD3bQE6ZLAvXGogc0Sm9YZyP9j cmz5WNsE0S5maUDIX8aH3jxRDA== X-Received: by 2002:a05:6402:205:b0:534:8bdf:a258 with SMTP id t5-20020a056402020500b005348bdfa258mr1969252edv.31.1696424587666; Wed, 04 Oct 2023 06:03:07 -0700 (PDT) Received: from krzk-bin.. (5-157-101-10.dyn.eolo.it. [5.157.101.10]) by smtp.gmail.com with ESMTPSA id m3-20020aa7d343000000b00530ccd180a3sm2394704edr.97.2023.10.04.06.02.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 06:03:01 -0700 (PDT) From: Krzysztof Kozlowski To: Vinod Koul , Bard Liao , Pierre-Louis Bossart , Sanyog Kale , Greg Kroah-Hartman , Philippe Ombredanne , Takashi Iwai , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski , stable@vger.kernel.org Subject: [PATCH] soundwire: fix initializing sysfs for same devices on different buses Date: Wed, 4 Oct 2023 15:02:43 +0200 Message-Id: <20231004130243.493617-1-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 04 Oct 2023 06:03:24 -0700 (PDT) If same devices with same device IDs are present on different soundwire buses, the probe fails due to conflicting device names and sysfs entries: sysfs: cannot create duplicate filename '/bus/soundwire/devices/sdw:0:0217:0204:00:0' The link ID is 0 for both devices, so they should be differentiated by bus ID. Add the bus ID so, the device names and sysfs entries look like: sdw:1:0:0217:0204:00:0 -> ../../../devices/platform/soc@0/6ab0000.soundwire-controller/sdw-master-1/sdw:1:0:0217:0204:00:0 sdw:3:0:0217:0204:00:0 -> ../../../devices/platform/soc@0/6b10000.soundwire-controller/sdw-master-3/sdw:3:0:0217:0204:00:0 Fixes: 7c3cd189b86d ("soundwire: Add Master registration") Cc: Signed-off-by: Krzysztof Kozlowski --- Sending as RFT, because I did not test it on that many devices and user-spaces. --- drivers/soundwire/slave.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/soundwire/slave.c b/drivers/soundwire/slave.c index c1c1a2ac293a..4db43ea53d47 100644 --- a/drivers/soundwire/slave.c +++ b/drivers/soundwire/slave.c @@ -39,14 +39,14 @@ int sdw_slave_add(struct sdw_bus *bus, slave->dev.fwnode = fwnode; if (id->unique_id == SDW_IGNORED_UNIQUE_ID) { - /* name shall be sdw:link:mfg:part:class */ - dev_set_name(&slave->dev, "sdw:%01x:%04x:%04x:%02x", - bus->link_id, id->mfg_id, id->part_id, + /* name shall be sdw:bus:link:mfg:part:class */ + dev_set_name(&slave->dev, "sdw:%01x:%01x:%04x:%04x:%02x", + bus->id, bus->link_id, id->mfg_id, id->part_id, id->class_id); } else { - /* name shall be sdw:link:mfg:part:class:unique */ - dev_set_name(&slave->dev, "sdw:%01x:%04x:%04x:%02x:%01x", - bus->link_id, id->mfg_id, id->part_id, + /* name shall be sdw:bus:link:mfg:part:class:unique */ + dev_set_name(&slave->dev, "sdw:%01x:%01x:%04x:%04x:%02x:%01x", + bus->id, bus->link_id, id->mfg_id, id->part_id, id->class_id, id->unique_id); } -- 2.34.1