Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp10665147imu; Mon, 31 Dec 2018 04:24:10 -0800 (PST) X-Google-Smtp-Source: AFSGD/U9ruBuCdUyaEZUKid38X0GLHfJIh33cDLKbwPjU6yCApv1/7WkYvSJweNVciKybKnLRvpn X-Received: by 2002:a62:4587:: with SMTP id n7mr37416539pfi.118.1546259049983; Mon, 31 Dec 2018 04:24:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546259049; cv=none; d=google.com; s=arc-20160816; b=BQ4yMBRonaxMQyFkzLOnensnfQQE0Ae6Ex732K7GKsk2C0UukTdeFssBZn7sMC7JMc 3zHg78l63A0wn/10JjVd5kf/45fMnFTQSxEiPyAAFYMKGAKJWWZbQChtn7HtwR77Xujc Ki13z++CPvCzskV6/F72NsYJm8HgFObqJHv3IqpLE31elVbOMDSKEOgLJuztroR/ZQkk 5KmgzGFRX7MPdxbq9tiY9Ggdyua+e/yIy3pAwNpClgOmkKlz/6cTW4QO5tWsqd3cM9C6 ZeFSPpZMFY9PWgsVV+eU2pXkstx249C5/ziQrvVXh98memCWhIHywnSGavKVTMu2FdLJ zHKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=J+Q1VfDsEMhpgAIiPRmFiPtlULVuqu36McELugsuCY0=; b=ibHdDLipOeMhxyYxaqJSo1Cs5KXVUY0ZHoL6ITf9NI9wUUkuqfXc7wHxbH6XpdphRk mAZEwGU3+TBDEtmiAAjbkaBy0UeZRKi1IC/5UfdYqsrl05jIOz/5QiD6/dBV7Z1i3mHs F+xlXbU/oXH6VTXj+imdpnOLhIusrCRKtP1IayUGJTxwhD5a3dueNlnMVocOg30dI4Ts /+EQCkVSu4o40KVTNQDTtRM+VOLAoEkWp6B2LNimKhoWai3Kx9BGaC2LjsC7qb7nB1uv u/EsbbPI7vEudmcJedrszlwDa/rck3Z1mvbvoZJyVcHyEvRs9fG9x7czpk+qFr1nLNJ1 I1Hw== 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 t4si12485348pgg.110.2018.12.31.04.23.53; Mon, 31 Dec 2018 04:24:09 -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 S1727277AbeLaMXF (ORCPT + 99 others); Mon, 31 Dec 2018 07:23:05 -0500 Received: from mail-qt1-f195.google.com ([209.85.160.195]:41732 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727174AbeLaMXF (ORCPT ); Mon, 31 Dec 2018 07:23:05 -0500 Received: by mail-qt1-f195.google.com with SMTP id l12so29116283qtf.8 for ; Mon, 31 Dec 2018 04:23:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=J+Q1VfDsEMhpgAIiPRmFiPtlULVuqu36McELugsuCY0=; b=AFp1FLvnui4ePsKXGMdbPL0s6WWlVHJ04NQgw369xg+G1GAFQjB66NYPBvhGghDbR+ aNY8ZJxv8ZQMmUy4WMabEX4cbij7G6vgQXgn+LDwuNHMyO2Pk4VoHjlatUWE4iSOHPBn 24inpn7CnEqD/lX24UmO6WOa9XpVK7xFUdJAHfPrh5RLiJPS5eBmjJ/lkttuKhWdY9kt PwN70OAE8uQhIBIvdZtjixPG6YEyaoYROK4Do9ZWmI1GBh4r4c701UsxYEbGuAJ0zhby amBzrobbMs1CE5T988snqtCf22mL4TAMfCCbw2afp5YC9XmiMcr363+ORyNND/eN1bdJ SrVw== X-Gm-Message-State: AA+aEWa+4iOKrctPEqNwyhfbE+3wQv7pkGZ3srlI3VCyErM5pv9MGE2O Ab4X8SxopMy0GdCXty2K2PubRanRj4Ul/wpDSGk= X-Received: by 2002:ac8:4141:: with SMTP id e1mr33774681qtm.96.1546258983914; Mon, 31 Dec 2018 04:23:03 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Arnd Bergmann Date: Mon, 31 Dec 2018 13:22:47 +0100 Message-ID: Subject: Re: [PATCH v8 00/25] Re-use nvram module To: Finn Thain Cc: Greg Kroah-Hartman , Linux Kernel Mailing List , linux-m68k , linuxppc-dev Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Dec 30, 2018 at 5:05 AM Finn Thain wrote: > > 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. Ok, I see. That sounds absolutely reasonable, so let's stay with the structure as you proposed. Arnd