Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp10509884rwp; Thu, 20 Jul 2023 23:42:00 -0700 (PDT) X-Google-Smtp-Source: APBJJlFHLBBBKHMfjc01HNSODW/nA5n0R6UBJSg10K0ssAXNp1Qzw7a5VImlYWu6KcA9AYCi0nss X-Received: by 2002:a17:902:7448:b0:1b9:ea60:cd89 with SMTP id e8-20020a170902744800b001b9ea60cd89mr1573203plt.7.1689921719765; Thu, 20 Jul 2023 23:41:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689921719; cv=none; d=google.com; s=arc-20160816; b=LyJIqzSJ7OmRcFLi8wO4P8wdFoZJDtovJvpWenr+kAH/l3v2PYybHk/NNyuKSZS06d yBCP1sb6gT8tArJ6rUYbnVZU5UMBPoU915dxvqdcQXSOyr3v8qx8uz/+6nLgpkq250bK q8Pvs1V4s6B4lCyiB32a2CxEIMAzS/ghC/eieAprubFDOEVNIKFkIaYshGiFPkwbE5g4 EDa3mHzc6ozeUeTKnsRh5vAxXMiSDN5OiIzNKUKTThaJzppFoCwn3ExucDavDsXWHUr3 aTxBpKU79Cd0/+b9HSSEo4gdPzjlWdMeYlkaqdEKOOimRcOe7Z2Uy3aPWqaArTDxHip5 Dd4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=dNj9HqDsh0etQFD7jEaoC/caRXY3w0DSveX/n+3VHl4=; fh=znJ/+xsNiUMsrKcIV4AU88AmxTDq6inGAqNdrhmyYF4=; b=mGbjvU1vBO7yfm2zErx6bWUYtv4sMDzR1BIborYwaIhGTRGtX/WX6MlAACqJ6oX7wP qEQbcALQiwFPDbiKG38CXgsZUhoziIOsZz/HIimOx2Mt30jfs4l32TlCH/ApB1j5MB23 +usBOT6g3esaFK4MtendDCtwha3gAVG9cpaoVQFyM98dCab/0QTFioE0RrS5eveRbFX8 pVkiPfFQcGxOOQO+dghhQnlJ/lm+fti7xE2cfc7qluZ55XoaiG74E4DXPLYa4XzVAbde nJnWhSa4hdwf2njXJIXFmqCBbmDM11pnMN+9ZO6MNYiWtahn6/ffAzpNIFtsfV+HBRah byhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=4p6T2id0; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j17-20020a170902da9100b001b872e3e3bfsi2565040plx.386.2023.07.20.23.41.47; Thu, 20 Jul 2023 23:41:59 -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=@infradead.org header.s=bombadil.20210309 header.b=4p6T2id0; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229487AbjGUGgq (ORCPT + 99 others); Fri, 21 Jul 2023 02:36:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231168AbjGUGgc (ORCPT ); Fri, 21 Jul 2023 02:36:32 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55CC730C0; Thu, 20 Jul 2023 23:36:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=dNj9HqDsh0etQFD7jEaoC/caRXY3w0DSveX/n+3VHl4=; b=4p6T2id0FidHtcx3NOENyCPePm Z3I2YToRlMfoa5NXVaq3fxELj//CxCV4hu3dntZFCb5YMC4EyxnxmepXmnrQnNqA1OoEyrxK2E7Iq 5TrmdWDBAqXhrc7t4c3X5pmKZPeO2x68/HOIzjAF9lUO7nZRstoNY3vZ6HgYd9XSRz0OaeIRQ5sfw 3OLawY/RiOuwBka8po6tIqM46jCHJerAUKpyabW8YJObfwwQGDcQ8+DZXM84reE43Yy+pxEAZ1lBB 0YQYRWrfgOMEIpwNDOfpJKHfTD3Wv9nsh/wMdN/9ufm0nyNr0vJ9l08ZGSAcSEPaaWj5tqWML84bX 0tD/I02A==; Received: from hch by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1qMjk3-00D37H-0b; Fri, 21 Jul 2023 06:35:55 +0000 Date: Thu, 20 Jul 2023 23:35:55 -0700 From: Christoph Hellwig To: Daniel Golle Cc: Jens Axboe , Ulf Hansson , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Dave Chinner , Matthew Wilcox , Thomas =?iso-8859-1?Q?Wei=DFschuh?= , Jan Kara , Damien Le Moal , Ming Lei , Min Li , Christian Loehle , Adrian Hunter , Hannes Reinecke , Jack Wang , Florian Fainelli , Yeqi Fu , Avri Altman , Hans de Goede , Ye Bin , Greg Kroah-Hartman , =?utf-8?B?UmFmYcWCIE1pxYJlY2tp?= , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, linux-mtd@lists.infradead.org Subject: Re: [RFC PATCH 6/6] block: implement NVMEM provider Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 > +static int blk_nvmem_reg_read(void *priv, unsigned int from, > + void *val, size_t bytes) > +{ > + pgoff_t f_index = from >> PAGE_SHIFT; > + struct address_space *mapping; > + struct blk_nvmem *bnv = priv; > + size_t bytes_left = bytes; > + struct folio *folio; > + unsigned long offs, to_read; > + void *p; Btw, this function really should be using kern_read on a file using filp_open instead of poking into block device internals. That way you can even have a generic file provider that works on anything that can be read from.