Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp9449550imu; Sat, 29 Dec 2018 20:07:03 -0800 (PST) X-Google-Smtp-Source: AFSGD/WD/dEbbokAbO517NBWdz4y+kYI4jSKsbzGkPlDgoDWLx/upTMFW+s8dhTBXkFQlBJW0Hf/ X-Received: by 2002:aa7:80d7:: with SMTP id a23mr33131882pfn.86.1546142823089; Sat, 29 Dec 2018 20:07:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546142823; cv=none; d=google.com; s=arc-20160816; b=QXdfF7Y3ZYNKOl6d5auUxMgJNoR3j9QzX8sIKj4aVKMtooM3669e9w4mElxfz4feWF JHJSuhsd8RtFD6AM1cUPxNUFUng7osasdgDUlKDMIj6i1pTUfrtt5q4/4ur80Nc5vwYs 2VZYhpahfqv5UxHUxlZ8w29egBCsur+Lo37plUndFl/lJ0MfexZ8Qcdz1z3w87Wa4K66 YGM1mRoYo4qTIT5JanOoPsGs9xkCLPiI0S0ceeDt7oWv0xRzH7rSN4m8IhSpq0fEt8IC MLOFownkV1VFTGVPdqK2v/+aY3OJaO/mgWMTtVlXO0cTUMK3NTxEpigHLB6/KF4s/5R2 DF2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:message-id :in-reply-to:subject:cc:to:from:date; bh=l9V1olJJVtzF2Icz9AIap1KYcpDgKgaGLs8hyBkZ/VU=; b=OAVyi05rMeuqg+GR9SeHRISnv+4PBNDDmR0M3nSgbWQQmfhSQo4nWJC8BBPP0cAVSw LrXQ+Cso7n8O55EkEOp6E3go1eYxlholdv0yYqIEOoSxUTREHAGlTJfIn4GiQZ2YPXiq qWwb3lQSukk0RAB76bu9AdRJ7r9Ansgd7W4mQhHjKEVvQ+GHEd1gTGbpyqi7pgVcYEM3 kI1bgkHXcoEL/nIDf1AvHlxi3uIfHrJzPGNqYvIXqaa+G38/gHfR4W+v1ltkrqlCz/rd BHxd7TTAj76dsrTMRgeuQILBfPYGTg8rUj3/GXn+hd9NIIKghhvoIoLuHD3cRaK6MQHf rOyg== 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 d189si45378864pfa.70.2018.12.29.20.06.47; Sat, 29 Dec 2018 20:07:03 -0800 (PST) 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 S1725980AbeL3EF5 (ORCPT + 99 others); Sat, 29 Dec 2018 23:05:57 -0500 Received: from kvm5.telegraphics.com.au ([98.124.60.144]:50982 "EHLO kvm5.telegraphics.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725925AbeL3EF5 (ORCPT ); Sat, 29 Dec 2018 23:05:57 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by kvm5.telegraphics.com.au (Postfix) with ESMTP id E3FC7297F9; Sat, 29 Dec 2018 23:05:52 -0500 (EST) Date: Sun, 30 Dec 2018 15:05:49 +1100 (AEDT) From: Finn Thain To: Arnd Bergmann cc: Greg Kroah-Hartman , Linux Kernel Mailing List , linux-m68k , linuxppc-dev Subject: Re: [PATCH v8 00/25] Re-use nvram module In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 30 Dec 2018, I wrote: > > I'm not opposed to exported functions in place of a singleton ops > struct. Other things being equal I'm inclined toward the ops struct, > perhaps because I like encapsulation or perhaps because I don't like > excess generality. (That design decision was made years ago and I don't > remember the reasoning.) The rationale for the ops struct was that it offers introspection. It turns out that PPC64 device drivers don't care about byte-at-a-time accessors and X86 device drivers don't care about checksum validation. But that only gets us so far. We still needed a way to find out whether the arch has provided byte-at-a-time accessors (i.e. PPC32 and M68K Mac) or byte range accessors (i.e. PPC64 and those platforms with checksummed NVRAM like X86 and M68K Atari). You can't resolve this question at build time for a multi-platform kernel binary, so pre-processor tricks don't help. Device drivers tend to want to access NVRAM one byte at a time. With this patch series, those platforms which need checksum validation always set byte-at-a-time methods to NULL. (Hence the atari_scsi changes in patch 3.) The char misc driver is quite different to the usual device drivers, because the struct file_operations methods always access a byte range. The NULL methods in the ops struct allow the nvram.c misc device to avoid inefficient byte-at-a-time accessors where possible, just as arch/powerpc/kernel/nvram_64.c presently does. --