Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5573098rwd; Sun, 18 Jun 2023 14:41:26 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6bK6+Gx3Pmpdh0mT5v3e+xYEmpQ8JqS3sgpv0p0m3GW4+lmpQZU9A6OZZM23Ffjqw6JAqo X-Received: by 2002:a17:902:8697:b0:1b4:f649:1151 with SMTP id g23-20020a170902869700b001b4f6491151mr7072732plo.2.1687124485941; Sun, 18 Jun 2023 14:41:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687124485; cv=none; d=google.com; s=arc-20160816; b=OBg3/r8JWUTbmKaeEdaLAjdwPYUinGnTJrSLNbEvWdLjaXoYEPSSBt1bAXqghdfCWn VHj04JmOUN+f+KhPouAMWPiHkPBleIlo7emXtYYcGPSyAgHmwtR7ombLlilyV4+HB+CF Bjijov8CagYRp9bRnIN92B/SY/Vuawr3N1xgFud2nti9znluWUA7lm5ksSQcKl90rrD/ tJPJUVK9r6UnSCMdykL2e6XWfXbiJyw8krkFWV3gHAigThqY7j0+AGEQOPwPc4As3sul bh10Zz+bLorcerzky7JRFE0k1HAiUUQ/9Yyt/Bv+XiZIfn4HWbHXf344IcrjaORwkKgO Sfeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=IOkfA4GaYDZQ1KN9R5z9rbZZiuOU0JFMDz+JkNVoMfs=; b=jWhyyeg8ljfSLk9HMIs9a3Ir+oodi65ETvG3lcMswNbwY9Z3J7nimDSVwtEOGOq+cC YoN+/7s2EWwJnERf5u1iGLIhpgTH0SvhyS5oH4bc4vjovNJHhmjGz2zogZIXgUOhjK0v DhtDsi7DYgLxMj1UAJN4mB2BWgxAh5D2Ih1exfFo4y6ODYr9rOGCIoYhcv3hTRNF6fus eaZ862tCyb89DvceVP0O7MYFpaJBjvW7DOwgbEgwJM9MGIXzxZC5WYRlHv9H1va9F0i8 +RyFgWJO70TEQHeUAr3UmOLnJ+HJ1uNylk8R0mnPvLZ/Wb4XGS6+ePqlO4T20hwq96z7 bFrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=aAQvxhth; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w14-20020a170902e88e00b001a979e702b2si5050478plg.416.2023.06.18.14.41.12; Sun, 18 Jun 2023 14:41:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=aAQvxhth; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229732AbjFRVeC (ORCPT + 99 others); Sun, 18 Jun 2023 17:34:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229456AbjFRVeB (ORCPT ); Sun, 18 Jun 2023 17:34:01 -0400 Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B594E1; Sun, 18 Jun 2023 14:34:00 -0700 (PDT) Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2b466744368so20640031fa.0; Sun, 18 Jun 2023 14:34:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687124038; x=1689716038; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=IOkfA4GaYDZQ1KN9R5z9rbZZiuOU0JFMDz+JkNVoMfs=; b=aAQvxhthEnemgwN0nPek8VPAe3c11NrE5vCc+DphFxmfMZqaWyrmMIZOwGm4aBNMQU NbjAdD3fhtV776hvXI2DVLsbuTuttHb+Pqdylq2JYMd05eBq/M+dacpuYlyuT87VXS4f LvISPpp4xWuHE0xCKecnyNtk52xGXkC6kOYVi73vbT5XKwyyERjRdP8ypjjID5mlLxj6 ZIFFaFYn4VE1gYK8CQ2fvE/U5BPsfr+rPqWG+BYCsL6aGj2KBdhzWCYx9vdofRRdvb0x WdqXu8l6XssSq4MDHy7V3A1g5kgP+C4cwtfLTTLLCatE7xUaT0PMdyKN5tCwalAJyEfT S53Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687124038; x=1689716038; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=IOkfA4GaYDZQ1KN9R5z9rbZZiuOU0JFMDz+JkNVoMfs=; b=Dh7G5/rO8Zs59+SL/8nchStUkJXiRk2BysEigQgiWz/qddAkQRI4Iy1U05dp4VK7oN UsYx94kmBMXvzGItJzP6WmXOeBzWoZQsCWF+ZaD+tw+SLRHxRlPO00qz3nP75Xi9ZsTV L+55dkSOIzisFGlmb3KuWkz1+QXngamRbrB3PiYPQNQcipBeepqCSXJpaJbMHOgHxZyu PhvPnrgm3NObwcV7WbxKFNCFRdZcBrneJoSiIdlDu9krcYTqxWqoOv9m1+q6UgS5hZUL YDi94qxQjyyfYfYHHBlChr5KngXxajWuVFSZLWM9bD1j+MbWCOBbecRWcn34ydURU9bD IxfQ== X-Gm-Message-State: AC+VfDzQSVf5camHpzkq1KoWxfmyzJKjCtx89FY4X2uVxcjARZkvL7WJ +vsoG1O4sQcBMLoNd4ZwwjI= X-Received: by 2002:a2e:90c9:0:b0:2b4:7380:235 with SMTP id o9-20020a2e90c9000000b002b473800235mr1036205ljg.32.1687124038186; Sun, 18 Jun 2023 14:33:58 -0700 (PDT) Received: from [192.168.2.145] (109-252-149-7.dynamic.spd-mgts.ru. [109.252.149.7]) by smtp.googlemail.com with ESMTPSA id s25-20020a2e9c19000000b002b469fd0baasm965650lji.111.2023.06.18.14.33.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 18 Jun 2023 14:33:57 -0700 (PDT) Message-ID: Date: Mon, 19 Jun 2023 00:33:56 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.2 Subject: Re: [PATCH v2 2/2] misc: sram: Generate unique names for subpools Content-Language: en-US To: Linus Walleij , Rob Herring , Krzysztof Kozlowski , Arnd Bergmann , Greg Kroah-Hartman Cc: Rob Herring , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org References: <20230417-ux500-sram-v2-0-6e62ad551faa@linaro.org> <20230417-ux500-sram-v2-2-6e62ad551faa@linaro.org> From: Dmitry Osipenko In-Reply-To: <20230417-ux500-sram-v2-2-6e62ad551faa@linaro.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 21.04.2023 00:17, Linus Walleij пишет: > The current code will, if we do not specify unique labels > for the SRAM subnodes, fail to register several nodes named > the same. > > Example: > > sram@40020000 { > (...) > sram@0 { > (...) > }; > sram@1000 { > (...) > }; > }; > > Since the child->name in both cases will be "sram" the > gen_pool_create() will fail because the name is not unique. > > Use dev_name() for the device as this will have bus ID > set to the fully translated address for the node, and that > will always be unique. > > Signed-off-by: Linus Walleij > --- > ChangeLog v1->v2: > - Stop complicating things and just use dev_name() > --- > drivers/misc/sram.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/drivers/misc/sram.c b/drivers/misc/sram.c > index f0e7f02605eb..f80c3adddf0b 100644 > --- a/drivers/misc/sram.c > +++ b/drivers/misc/sram.c > @@ -240,10 +240,11 @@ static int sram_reserve_regions(struct sram_dev *sram, struct resource *res) > goto err_chunks; > } > if (!label) > - label = child->name; > - > - block->label = devm_kstrdup(sram->dev, > - label, GFP_KERNEL); > + block->label = devm_kasprintf(sram->dev, GFP_KERNEL, > + "%s", dev_name(sram->dev)); This broke device-trees that have no label property. The SRAM DT binding says: " label: description: The name for the reserved partition, if omitted, the label is taken from the node name excluding the unit address. " Not sure whether breakage was on purpose, otherwise doc needs to be updated or there should be explicit check for the duplicated node names. Secondly, AFAICS, the dev_name(sram->dev) is the name of the parent SRAM device and not of the children sub-nodes, hence it's now always the same dev_name(sram->dev) for all sub-nodes.