Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3462265yba; Mon, 8 Apr 2019 20:24:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqxWGJFdpiKOgBvRFRrIbdduYM5DWwnmc1tn5wZDVsLTLKrsyUggbCy3Qu55vkIU/zhLj6gr X-Received: by 2002:a17:902:aa87:: with SMTP id d7mr34461892plr.146.1554780271145; Mon, 08 Apr 2019 20:24:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554780271; cv=none; d=google.com; s=arc-20160816; b=K+PUk55+PpQikFp2iVpXXaZrh7e54VpRQZcpWp6/vplr8PxKzZ0U+VWagqbWCIJFev i+r1rWKMdkReplg/lIQwdmiE9UM+rginmYGvecEKfbFvTrt54DVw7ZAo8m/JiYnp5GwV 6v1TQ20h/jqeXvxK8063Jnr2IDeXBWUOI7KHFNXyw9awAfW11XYQMQzX2sr+NPzW5OWC C7/AdLYs02H/3/inIKZ3q10kBj0SpPGkSq3BY7z6ov9R+eqQzrQhxlYAsRKWWKuMEiim l+ctHOrJG/gtXVVGFZCTF0qxzJOGTf0BMPg4XdLvZmFphHrhPfQHVw0231cOyQXRCXD7 R21g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature:dkim-filter :date; bh=6sq4QRoaUT162PxaRzedOhV5IPeOyGs+EtwLB1FzIv0=; b=MANhWTmgMX98WzeBNTT9udNazjYIY0Htsc22d4Qp7ueBX4Tr9HcjDjf8fooLcN1/Gw n8vsu3i3xsGFHMuwkgikacys8H69tTBDoJpC4SVzRVCib38K23d9HzmVd5/K1E94nOrd dTa3KUvuBqdGqg8ZeYBdWdU5j1y7NX7f03UJNnbkzJWKn8W8uwWBs7+jebVGMgFFKcTS f3T2GjOpFrQuEmDF148i0TVcjGAo2d2rOPCoduGNk5UlWlJM3O3EB8GR1pWz5tx7tp8L wKhWjxN/N4KSpmrFXFiU/bfzt08sOKPxkvPlWusujZdtkw6EhjKtj7MeYKW93zN2BLCd gANA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@innovation.ch header.s=default header.b=VvPAADhp; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=innovation.ch Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p87si22907785pfa.77.2019.04.08.20.24.15; Mon, 08 Apr 2019 20:24:31 -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=pass header.i=@innovation.ch header.s=default header.b=VvPAADhp; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=innovation.ch Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726539AbfDIDXc (ORCPT + 99 others); Mon, 8 Apr 2019 23:23:32 -0400 Received: from chill.innovation.ch ([216.218.245.220]:39204 "EHLO chill.innovation.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726081AbfDIDXc (ORCPT ); Mon, 8 Apr 2019 23:23:32 -0400 Date: Mon, 8 Apr 2019 20:23:31 -0700 DKIM-Filter: OpenDKIM Filter v2.10.3 chill.innovation.ch 439C964013A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=innovation.ch; s=default; t=1554780211; bh=6sq4QRoaUT162PxaRzedOhV5IPeOyGs+EtwLB1FzIv0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VvPAADhpzA8nI6B2Fsk3D8zRMe6OMzsIREesSfHtn0ady6Q0YB6JMbGcXs62mwUw0 Io42qqv7oCBhvBLNOpov7jdt/scezh6JQcgjV46C/c43O07n0RlzebCWfpavz4tv1h 5db6fWn//83IMA3eqsFr06M3KgeaksS2RRgCH3fs1/HEK+kmefxVPRTAo56y1V5de7 x2fEQtUSyhHCw/aYLlY9WnE39rdPRnHQjfo0cgLGsyBrCheO04VkSd3jr5nxpndddL 95vjHWkN65gKY5IeGakdYmHngQCXD/JvwvzmHRzx7s0PKfBJp3ZqKUtatL+lG92GCl BjvPhqo7CzY4w== From: "Life is hard, and then you die" To: Andy Shevchenko Cc: Dmitry Torokhov , Henrik Rydberg , Greg Kroah-Hartman , Lukas Wunner , Federico Lorenzi , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 2/2] Input: add Apple SPI keyboard and trackpad driver. Message-ID: <20190409032331.GA478@innovation.ch> References: <20190407050358.2976-1-ronald@innovation.ch> <20190407050358.2976-3-ronald@innovation.ch> <20190408123343.GO9224@smile.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190408123343.GO9224@smile.fi.intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 08, 2019 at 03:33:43PM +0300, Andy Shevchenko wrote: > On Sat, Apr 06, 2019 at 10:03:58PM -0700, Ronald Tschal?r wrote: > > The keyboard and trackpad on recent MacBook's (since 8,1) and > > MacBookPro's (13,* and 14,*) are attached to an SPI controller instead > > of USB, as previously. The higher level protocol is not publicly > > documented and hence has been reverse engineered. As a consequence there > > are still a number of unknown fields and commands. However, the known > > parts have been working well and received extensive testing and use. > > > > In order for this driver to work, the proper SPI drivers need to be > > loaded too; for MB8,1 these are spi_pxa2xx_platform and spi_pxa2xx_pci; > > for all others they are spi_pxa2xx_platform and intel_lpss_pci. For this > > reason enabling this driver in the config implies enabling the above > > drivers. > > Thank you for an update, my comments below. Thank you again for your review. [snip] > > + } else { > > + struct dentry *ret; > > + > > + ret = debugfs_create_bool("enable_tp_dim", 0600, > > + applespi->debugfs_root, > > + &applespi->debug_tp_dim); > > + if (IS_ERR(ret)) > > + dev_warn(&(applespi)->spi->dev, > > + "Error creating debugfs entry enable_tp_dim (%ld)\n", > > + PTR_ERR(ret)); > > Can ret be NULL? No, it actually can't (I manually traced all code paths to be sure): the documentation for these helper functions is wrong in this respect. However, I note that a lot of existing kernel code also has this wrong (i.e. it's checking for NULL). Digging a bit further and looking at the history, it appears this was changed just recently (commit ff9fb72b "debugfs: return error values, not NULL"), which would explain the existing code and documentation. I'll submit a patch to update the docs. > dev_dbg() looks more appropriate. Hmm, ok, I guess I find this a bit odd, though: true, this only affects code used for debugging, but it's nevertheless an error that shouldn't normally occur. Cheers, Ronald