Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp702061ybm; Tue, 21 May 2019 01:58:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqzX4KR8WWgkEnp58Qnb0hS9OcxmdRCt593SsBctkKsdYd/AopD6lPjE/Fvdo7OVgy80s/fc X-Received: by 2002:a17:902:bc42:: with SMTP id t2mr29849957plz.55.1558429120175; Tue, 21 May 2019 01:58:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558429120; cv=none; d=google.com; s=arc-20160816; b=TQ4lnZp4zSCTmm0drUgJ3N5gRxnUrbisUlDcji0h10VqCksA4TdlWGXCU2nniYMpQn c6sPXDusOSrPVSkA6WsYdiVyzwiJBHYrLuaNuYN6ehm4Y1jdM9gfGEz4+MpmeFEb47tb Ey4mCRB8CEyIvA6pLkumEEM9cGNO2YkpFOD7gq/Erg5L0QJqbrHwLXiY+nin8mPSVD5e WphUMJup7e6svhCBv499N7xYBgCmh/K2tf9L3HNSzEWcTrC0kvDwr3tNQdLIjBjkWVI4 9DjchFsOvvU+n+55qFRYvYb6KwgYbXmMnaW7S3Mz6rUkyc+GaoK25fMNc0DY0nIywlmz L6MQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date; bh=ebrIj9wO+z1WFiPcKrCJa9h0MU3DUI1PQLbJ3BxVu3c=; b=0Joc3+yPVSinh5AfLELt8n3MvlDXwANPTixbvUh6fxIdU0JlphC0PRs37A+/RSBBGq zIb5NuMCs+dP7sARIcQstujYDJWp9prQrWhCN7lalLbnDiDJktbOoXiNq4ZhccZ5a8I3 /hre56L4QaXy0FaGXWX0+u1XutA/GGyYFUiKBZqmt4VHW/TqR6IyILfjLFLHX5O0mqz8 PAfnAwj9SAjiBalhaA6bmwT56ltCX3cizOaehUKYTfR9ngYRa6vMAkXxE7KRY5lItU0T bnWPCyz7NNsB5pW3vAk0BsRsahUt8q7r9E4tE+h3UT9tWcvebzyJo61DGT7OuzfrA+3b ismg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s21si19896649pgk.139.2019.05.21.01.58.25; Tue, 21 May 2019 01:58:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727137AbfEUI4o (ORCPT + 99 others); Tue, 21 May 2019 04:56:44 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:57045 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726242AbfEUI4n (ORCPT ); Tue, 21 May 2019 04:56:43 -0400 Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hT0Zd-00057d-TZ; Tue, 21 May 2019 10:56:41 +0200 Received: from sha by ptx.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1hT0Zd-0001Nd-F9; Tue, 21 May 2019 10:56:41 +0200 Date: Tue, 21 May 2019 10:56:41 +0200 From: Sascha Hauer To: linux-kernel@vger.kernel.org Cc: Srinivas Kandagatla , kernel@pengutronix.de, linux-mtd@lists.infradead.org Subject: nvmem creates multiple devices with the same name Message-ID: <20190521085641.i6g5aijwa5zbolah@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-Uptime: 10:44:24 up 3 days, 15:02, 48 users, load average: 0.16, 0.10, 0.09 User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: sha@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi all, nvmem derives the device name directly from the partition name of the underlying device. IMO this is wrong since it's not possible to create two partitions with the same name on different devices. In my case I have a NAND device and a SPI NOR device which both happen to have a partition named 'barebox'. This ends up with: [ 11.222196] sysfs: cannot create duplicate filename '/bus/nvmem/devices/barebox' [ 11.230136] CPU: 0 PID: 1 Comm: swapper/0 Tainted: G W 5.2.0-rc1-00014-g793f23e5adb0-dirty #676 [ 11.240414] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree) [ 11.247174] [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [ 11.255171] [] (show_stack) from [] (dump_stack+0xd8/0x110) [ 11.262722] [] (dump_stack) from [] (sysfs_warn_dup+0x50/0x64) [ 11.270527] [] (sysfs_warn_dup) from [] (sysfs_do_create_link_sd+0xcc/0xd8) [ 11.279487] [] (sysfs_do_create_link_sd) from [] (bus_add_device+0x80/0xfc) [ 11.288441] [] (bus_add_device) from [] (device_add+0x328/0x608) [ 11.296423] [] (device_add) from [] (nvmem_register.part.1+0x168/0x5e4) [ 11.305030] [] (nvmem_register.part.1) from [] (add_mtd_device+0x1e8/0x404) [ 11.313988] [] (add_mtd_device) from [] (add_mtd_partitions+0x74/0x15c) [ 11.322589] [] (add_mtd_partitions) from [] (parse_mtd_partitions+0x180/0x368) [ 11.331807] [] (parse_mtd_partitions) from [] (mtd_device_parse_register+0x40/0x164) [ 11.341560] [] (mtd_device_parse_register) from [] (m25p_probe+0x118/0x200) [ 11.350513] [] (m25p_probe) from [] (spi_drv_probe+0x80/0xa4) While it's easy to rename the partitions I see no reason why it should be illegal to have two different (mtd) devices with eqeally named partitions. Are there any suggestions how to register the nvmem devices with a different name? Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |