Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3113502pxf; Mon, 15 Mar 2021 01:29:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzzUD3eGYPo+iFNBSrIc/RjJWQufDC9p56TgT+eEMLK5jycVC6/xp7hZfU/3Jo9hzAq/6xI X-Received: by 2002:aa7:d841:: with SMTP id f1mr28269271eds.286.1615796944526; Mon, 15 Mar 2021 01:29:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615796944; cv=none; d=google.com; s=arc-20160816; b=Ss3xAIQJM65iug9NzDtpvPBFWRqb+zZFN02I1u48K5BPbCVg9XRuLD5H4PG10ZOu9m WAm5NrhdicKCzVU5ox9aX9zSagzMG5+wfO15mNOHm05hvcbOBZPj1kgpx0pFIa+BE4O6 ZiDlB5qVuiX+Uhlkh84FZnc1zKPPdl0LR7c51lf0ZGLBFXZFxGcw5kezLMpThYjGwkLN Bb/aJrXrjLyMi7GUgGjNn/hGbY8YMXU1E//iPMbXbM7YjYeWWt1Dfsel7WdFIAb6iSlG 5Z0BtrMkAG+9zIrhEfxAxrVJILC2hFm7dOjpcc4a/C1QZLEODdJITM++XojfQM6N2pRV LxBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ThVlhMXeZ2BXtsWAnaBf+g8M4+4//YJhVJ5l/5E+JAM=; b=phANuhDGp7THxy2Yz6+9F6KchHPL1kxuszamdzRM2NR/qSaQC5HB7OzQTLCbHETJSq oAFjJ5L6MvkmbhkE/hOL2dJaw+fUMpNe9GpK0OX6M7Lrs1g4zWRMVUo+HgJQfOsoJ4Hc Qs27PB9Iigf1TqhQoeabRT6e33QuVXTAtTSwoAfMzqEUu/AzJ6zI2vjJ9b+AjqAu54F2 WFgAkd9E9NcDHbGBPv+QPfn7EiA9FTrt52mJEp+YLbQn2LXVMff9Op8cQcEZSC2A8wjL UeN7nJLHdOXaCHVvveIDnQafMBvG+X4tgO0gYTzKMqJLUm8sVdK/oVxRQd6rWuNY/UIr yVFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Eeuq8+1A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lt12si10490659ejb.158.2021.03.15.01.28.42; Mon, 15 Mar 2021 01:29:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Eeuq8+1A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230200AbhCOI1k (ORCPT + 99 others); Mon, 15 Mar 2021 04:27:40 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:54458 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230245AbhCOI1i (ORCPT ); Mon, 15 Mar 2021 04:27:38 -0400 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 12F8RELR106326; Mon, 15 Mar 2021 03:27:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1615796834; bh=ThVlhMXeZ2BXtsWAnaBf+g8M4+4//YJhVJ5l/5E+JAM=; h=Date:From:To:CC:Subject:References:In-Reply-To; b=Eeuq8+1AVXCDE8ZKGrEn+7JASnlayaeHo+OAenh7Ndgj8z/bOaxq2QRQ+ybkwZe5f PFlRtDJRwwrebx5oKVb3N8stN6Q0894IGzsFIhttvOnXtl17Fayb9qjYaekNO3DNMT RS2QhH+uS7ZScIdkdYlU3OOujPDymmYqp/iQLSEc= Received: from DFLE115.ent.ti.com (dfle115.ent.ti.com [10.64.6.36]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 12F8REtc088419 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 15 Mar 2021 03:27:14 -0500 Received: from DFLE105.ent.ti.com (10.64.6.26) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Mon, 15 Mar 2021 03:27:13 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2 via Frontend Transport; Mon, 15 Mar 2021 03:27:13 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 12F8RCux108246; Mon, 15 Mar 2021 03:27:13 -0500 Date: Mon, 15 Mar 2021 13:57:12 +0530 From: Pratyush Yadav To: CC: , , , , , Subject: Re: [PATCH v2 4/5] mtd: spi-nor: Move Software Write Protection logic out of the core Message-ID: <20210315082710.l7esv3kwickj6yg3@ti.com> References: <20210306095002.22983-1-tudor.ambarus@microchip.com> <20210306095002.22983-5-tudor.ambarus@microchip.com> <7fb8af561eda06444ee0e0c592147af7@walle.cc> <65691b2a-134d-b1f2-617e-5ef09df9a742@microchip.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <65691b2a-134d-b1f2-617e-5ef09df9a742@microchip.com> User-Agent: NeoMutt/20171215 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 15/03/21 06:09AM, Tudor.Ambarus@microchip.com wrote: > On 3/6/21 1:19 PM, Michael Walle wrote: > > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe > > > > Am 2021-03-06 10:50, schrieb Tudor Ambarus: > >> It makes the core file a bit smaller and provides better separation > >> between the Software Write Protection features and the core logic. > >> All the next generic software write protection features (e.g. > >> Individual > >> Block Protection) will reside in swp.c. > >> > >> Signed-off-by: Tudor Ambarus > >> --- > > > > [..] > > > >> @@ -3554,6 +3152,9 @@ int spi_nor_scan(struct spi_nor *nor, const char > >> *name, > >> ????? if (ret) > >> ????????????? return ret; > >> > >> +???? if (nor->params->locking_ops) > > > > Should this be in spi_nor_register_locking_ops(), too? I.e. > > > > void spi_nor_register_locking_ops() { > > ??? if (!nor->params->locking_ops) > > ??????? return; > > .. > > } > > Yes, the checking should be done inside spi_nor_register_locking_ops, > will move it. > > Btw, what do you find a better name, spi_nor_register_locking_ops or > spi_nor_init_locking_ops? Applies to OTP as well. On a quick glance, spi_nor_register_locking_ops() can be mistaken to mean "Register locking ops". That is, ops to lock/unlock flash registers. If you do want to keep using "register", IMO spi_nor_locking_ops_register() would be better. > > Thanks, > ta > > > > > I don't have a strong opinion on that so far. I just noticed because > > I put the check into spi_nor_otp_init() for my OTP series. They should > > be the same though. > > > >> +???????????? spi_nor_register_locking_ops(nor); > > > > -michael > -- Regards, Pratyush Yadav Texas Instruments Inc.