Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp432295imm; Fri, 17 Aug 2018 00:02:01 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzZ+jBjrZ8Y+7MZ7kVSWe5BX1eWoPYYKRhwvhBqrK/9ixCXKvzJfiE7+iNvoyEWUFIddDIv X-Received: by 2002:a17:902:7009:: with SMTP id y9-v6mr32837205plk.249.1534489321731; Fri, 17 Aug 2018 00:02:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534489321; cv=none; d=google.com; s=arc-20160816; b=slbrym1IzxbiHx+uXN1K8/83HinrBgpMDDR7ozD6zxTCCttGYYqxS1iPFhWPNguIIn 4tix2X/EEQRuLnaXlO57e/5amYTxieqc4WNCv3Mb7UFGPzIDlCGYJJ442VaPC2GEkQt+ WlCuRUBjmhPZynQQALg/W/62NgmwQV1cp1JROazry24apx+kAvZh2LQ/Wi+TQad4ijqa NTtsMmcGRMwhj6WbiLJNo9LViJ5iDEi/nTxcKnumxekmM2TR4rra41ShLCpIXJLR+DKG jIc6dUgtEomIaF7ygnWCA8wiABW6lpfFtOvKzjS0e5+aAR1FxJbry7vs8kCVZAzg6Kno gPjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=eAW4TSQu85FAKVW8YxCsIpp309J3LN2PIWCPbNUbh0c=; b=SnRsNxzSmXnrZLqA+ZCaE5nSUALBc9ygcaPPtiAIiN79jOt54ayzwDIjTeue8y1IKO AwyWISrGjBkzw0dP46kbZ8DYa0ohiE6bZfKu//iS/tuicGwkj/Vt0TGh15jsR/A34Trg Mv05pkqHwv5T4kQCCZcLou6nZVgG8BdAS7bBRfZm4+36232Nqb3Rl4bgDKGC4aQkl0zM DP03EP2Cmz/wcA/PNO8jwMCuhEof/BNNAb0J+mJnJdVJJFQvyR4xE70atK2KoVM3hNqE kxkOOF/jqnoMYtxFLlDcs8Qy8jzadDdq0jrbDq0KVdmmxDwRjQe+n8R9ayZS5MnVV/71 aA4g== 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 e34-v6si1680127plb.2.2018.08.17.00.01.45; Fri, 17 Aug 2018 00:02:01 -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 S1726551AbeHQKBZ (ORCPT + 99 others); Fri, 17 Aug 2018 06:01:25 -0400 Received: from verein.lst.de ([213.95.11.211]:34111 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726226AbeHQKBY (ORCPT ); Fri, 17 Aug 2018 06:01:24 -0400 Received: by newverein.lst.de (Postfix, from userid 2407) id 5032568EEE; Fri, 17 Aug 2018 09:00:13 +0200 (CEST) Date: Fri, 17 Aug 2018 09:00:13 +0200 From: "hch@lst.de" To: Bart Van Assche Cc: "hare@suse.de" , "axboe@kernel.dk" , "hch@lst.de" , "linux-kernel@vger.kernel.org" , "keith.busch@intel.com" , "linux-nvme@lists.infradead.org" , "linux-block@vger.kernel.org" , "hare@suse.com" , "sagi@grimberg.me" Subject: Re: [PATCH 2/5] nvme: register ns_id attributes as default sysfs groups Message-ID: <20180817070013.GD11170@lst.de> References: <20180814073305.87255-1-hare@suse.de> <20180814073305.87255-3-hare@suse.de> <5a4aab8b5f509d8090ad10107b01d11285fe1528.camel@wdc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 14, 2018 at 03:44:57PM +0000, Bart Van Assche wrote: > On Tue, 2018-08-14 at 17:39 +0200, Hannes Reinecke wrote: > > While I have considered having nvme_nvm_register_sysfs() returning a > > pointer I would then have to remove the 'static' declaration from the > > nvm_dev_attr_group_12/20. > > Which I didn't really like, either. > > Hmm ... I don't see why the static declaration would have to be removed from > nvm_dev_attr_group_12/20 if nvme_nvm_register_sysfs() would return a pointer? > Am I perhaps missing something? No, I think that would be the preferable approach IFF patching the global table of groups would be viable. I don't think it is, though - we can have both normal NVMe and LightNVM devices in the same system, so we can't just patch it over. So we'll need three different attribut group arrays: const struct attribute_group *nvme_ns_id_attr_groups[] = { &nvme_ns_id_attr_group, NULL, }; const struct attribute_group *lightnvm12_ns_id_attr_groups[] = { &nvme_ns_id_attr_group, &nvm_dev_attr_group_12, NULL, }; const struct attribute_group *lightnvm20_ns_id_attr_groups[] = { &nvme_ns_id_attr_group, &nvm_dev_attr_group_20, NULL, }; and a function to select which one to use.