Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4079306imm; Mon, 11 Jun 2018 06:43:44 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJCsL7GfHhz/yo03+PkXU/K2gngvVOkxszdmaFz674dbXb2iDw1SrsGfWaUhZy9AYyIRmU9 X-Received: by 2002:a17:902:b946:: with SMTP id h6-v6mr18252342pls.1.1528724624635; Mon, 11 Jun 2018 06:43:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528724624; cv=none; d=google.com; s=arc-20160816; b=L7bvZpl42/HrtBc4rmobXWztsCEf1QViOnxQiqcyxq3sGmVQCShJCDT/9ln2+r0uIc EPpALdNbTC6TavpB6x9dMNoe42w0pCL+UoO7yrFbxWaB88JWFtpmc2sfs19AqwPDGcNJ 9i+yWfpUWH/6q4xDg8VX/Cz8Is+WH2B9NObBM1jxYl7oZsDxzkOm7vz3ZwSawBdIYBqY CuB0AajJA+LdgI21zfjoUVvjmvXXHQ4GOiE+Fjj+HCwQNzmeP3CODK7CsbrIrkn1+jHi bkRaJl7fgVRF2PjN3QgFLonGS+66pkhjroK95bKDEHsxBv+vfY3SgLgui5bSqhfye5UI S9Aw== 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 :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=eLE1+Xqa4ovl+iM3K6g5LThkrbboXYHn47RULbSeKao=; b=cQ5oWife4UFQQ/8wA+LrUjgueHV2fr+6AzSr1CfrblrvCTLBjc1TABWVAypSc480lL yF0GfF2aLKvD8sEY5gNQGvevs+92hlsFC3+WSb9++K4cahkxoVXkdIgx2Ujab5ljOr/F 7HQp8w78pgqztpGCFJEpXwGbCfokEXq1qgGukrDinBMNj1S7OevwwFlj8G8xITUncHWw xhy7QIxDSuAkejf7gLuG+UtUxT5Ca1452facqi7v8px/fyw8ZyftdS1+jRRXINJEwZgR Hvk0+owWlTB5XTpjpAj/BmGjIyOjc2GHeNpTwTvhKNt557GpCFuz/Sd44cyZ3bHQsYbL 0MdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=baDsWe+S; 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 e10-v6si12726379pga.8.2018.06.11.06.43.29; Mon, 11 Jun 2018 06:43:44 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=baDsWe+S; 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 S933156AbeFKNnG (ORCPT + 99 others); Mon, 11 Jun 2018 09:43:06 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:41059 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754053AbeFKNnE (ORCPT ); Mon, 11 Jun 2018 09:43:04 -0400 Received: by mail-lf0-f66.google.com with SMTP id d24-v6so30594700lfa.8 for ; Mon, 11 Jun 2018 06:43:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=eLE1+Xqa4ovl+iM3K6g5LThkrbboXYHn47RULbSeKao=; b=baDsWe+SYSHwITlzqYGAatf3otBRVQF0Vo3Jih7Z/6ynEdU6yk3cA8todjTETuCkdu XeEP4Z/P3Mp0C2tpy3Y/kZQ5InxZlC9tb7buJ+rrd4IOv2s21VJJCxzpOFrYhGTSQTQc 0sFrFjM+HH+2gd6DJI1D9mvrWetoqZiIxgdxetrVHG2jnsY+mfemlAx0+imY4IBq97SB s5AoWSDkDdDgzjimGy6PpEs904lwKPx2xYkpaTQ7DxfUXzCR0tEOA/mXmLdq5jKqGRDU V1t49NADcAhxuavo0FBoI2MRao9ftReY2rLveHZWfFm0DEVHxyV1zFjdiqbXxsIaD7/9 17fA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=eLE1+Xqa4ovl+iM3K6g5LThkrbboXYHn47RULbSeKao=; b=r3AQ1PBglOVYm0RGbwHrYRZo7urYgHJEblKV0P5995M58uwVC4XdFZjmLvtRBnkYkO QbrGZfg5LnUUotu6wO9NAu9GtHvyZJGgexo8HAk16L6T0M0Wsmb4ThmGCPK77EMgtV/F XUYch7ScivEvFhVeCUsvnSiT96O2AkzKxHGD2W++QMoOtm4m+h0tLCLkBXdorEPkPHNl 2m325rXmNKQwdUId507hADwAQ4NT77CQWzHuIbRinJFe945LnG6tqtI+n6fzXHQKdhhG Gq4oKp+o1QGA3T5qJEfdpTZZJo4qKjFhW0QkturF+qzhimltoo9x+eKCiQWBYBbf2Uve 5GeA== X-Gm-Message-State: APt69E0ouYtSrTPdAUZqpdCWooqU1sesWWo5qOgXXMKhNrRC3R2vnRPj ifzZ0rGs5HOoI9JpbzZxVsWanuHqGMVxKvTPkcM= X-Received: by 2002:a19:3b0e:: with SMTP id i14-v6mr10258430lfa.48.1528724583057; Mon, 11 Jun 2018 06:43:03 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a2e:56c8:0:0:0:0:0 with HTTP; Mon, 11 Jun 2018 06:43:02 -0700 (PDT) In-Reply-To: <20180611042515.ml6zbcmz6dlvjmrp@thebollingers.org> References: <20180611042515.ml6zbcmz6dlvjmrp@thebollingers.org> From: Arnd Bergmann Date: Mon, 11 Jun 2018 15:43:02 +0200 X-Google-Sender-Auth: YNOABGTAJGiWQKsIJPkIvtVEY6o Message-ID: Subject: Re: [PATCH] optoe: driver to read/write SFP/QSFP EEPROMs To: Don Bollinger Cc: Greg Kroah-Hartman , Linux Kernel Mailing List , brandon_chuang@edge-core.com, wally_wang@accton.com, roy_lee@edge-core.com, rick_burchett@edge-core.com, quentin.chang@quantatw.com, jeffrey.townsend@bitswitch.com, scotte@cumulusnetworks.com, roopa@cumulusnetworks.com, David Ahern , luke.williams@canonical.com, Guohan Lu , Xin Liu , steve.joiner@finisar.com 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 Mon, Jun 11, 2018 at 6:25 AM, Don Bollinger wrote: > optoe is an i2c based driver that supports read/write access to all > the pages (tables) of MSA standard SFP and similar devices (conforming > to the SFF-8472 spec) and MSA standard QSFP and similar devices > (conforming to the SFF-8436 spec). > > These devices provide identification, operational status and control > registers via an EEPROM model. These devices support one or 3 fixed > pages (128 bytes) of data, and one page that is selected via a page > register on the first fixed page. Thus the driver's main task is > to map these pages onto a simple linear address space for user space > management applications. See the driver code for a detailed layout. > > EEPROM data is accessible via a bin_attribute file called 'eeprom', > e.g. /sys/bus/i2c/devices/24-0050/eeprom. > > Signed-off-by: Don Bollinger > + > +#undef EEPROM_CLASS > +#ifdef CONFIG_EEPROM_CLASS > +#define EEPROM_CLASS > +#endif > +#ifdef CONFIG_EEPROM_CLASS_MODULE > +#define EEPROM_CLASS > +#endif I don't understand this part: I see some older patches introducing an EEPROM_CLASS, but nothing ever seems to have made it into the mainline kernel. If that class isn't there, this code shouldn't be either. You can always add it back in case we decide to introduce that class later, but then I wouldn't make it a compile-time option but just a hard dependency instead. > +struct optoe_platform_data { > + u32 byte_len; /* size (sum of all addr) */ > + u16 page_size; /* for writes */ > + u8 flags; > + void *dummy1; /* backward compatibility */ > + void *dummy2; /* backward compatibility */ > + > +#ifdef EEPROM_CLASS > + struct eeprom_platform_data *eeprom_data; > +#endif > + char port_name[MAX_PORT_NAME_LEN]; > +}; What is the backward-compatibility for? Normally we don't do it like that, we only keep compatibility with things that have already been part of the kernel, especially when you also have an #ifdef that makes it incompatible again ;-) > +struct optoe_data { > + struct optoe_platform_data chip; Maybe merge the two structures into one? Arnd