From patchwork Sat Mar 10 11:19:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars-Peter Clausen X-Patchwork-Id: 10273441 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 640E4602BD for ; Sat, 10 Mar 2018 11:20:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5269329B5C for ; Sat, 10 Mar 2018 11:20:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 43DAE29B76; Sat, 10 Mar 2018 11:20:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CA93B29B5C for ; Sat, 10 Mar 2018 11:20:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:From:References:To:Subject:Reply-To:Content-ID:Content-Description :Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=HafU+Kr1/+H68CUY3Qg8PQppvkR+Xv7BKDYCO/OqVR0=; b=ER+Zvou4WmlcXi O2cJteHTe8btbNo2SiEOR5DSRLxc2WSR3bnToucCTrz7IVgYiKfIDU8YMm8ohaD2KyjxLhaOiHxlX wmhjtol4FjtXPHBR2wBlVJnSnDIqyXN5tumd4N6LyD+HAN4cZS26mGAG9L7N+V9ybCGD8LrdxDp4J wDjhTC0imWLPoJS/uCPnDkZkCM4h5d47QX3cDCvYmcuvDqKGCwTjCrk1Lin5/iGHm7k1kD4rPD+ea hss18s1ZAVC7Afw3jpZ7scfMVQ67ji2Py/8JM9HWDVV6pDk1fB7EI5WNqQBA5KhTknn2TrYVuoYq5 AObGwINT9hCw5ep1gOUQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eucY2-0002lb-8e; Sat, 10 Mar 2018 11:20:22 +0000 Received: from www381.your-server.de ([78.46.137.84]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eucXh-0001pO-GG for linux-arm-kernel@lists.infradead.org; Sat, 10 Mar 2018 11:20:06 +0000 Received: from [88.198.220.131] (helo=sslproxy02.your-server.de) by www381.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.85_2) (envelope-from ) id 1eucXD-0002ED-SN; Sat, 10 Mar 2018 12:19:31 +0100 Received: from [93.104.106.31] (helo=[192.168.178.40]) by sslproxy02.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-SHA:256) (Exim 4.84_2) (envelope-from ) id 1eucXD-000153-Hk; Sat, 10 Mar 2018 12:19:31 +0100 Subject: Re: Nokia N900: v4.16-rc4: oops in iio when grepping sysfs To: Pavel Machek , Greg KH , jic23@kernel.org, akinobu.mita@gmail.com, javier@osg.samsung.com, gregor.boirie@parrot.com References: <20180309221220.GA15272@amd> <20180309222821.GA16973@kroah.com> <20180309230124.GA17721@amd> From: Lars-Peter Clausen Message-ID: <1bb9aa1e-1a78-5d1c-d2d6-f2cd6b925f31@metafoo.de> Date: Sat, 10 Mar 2018 12:19:29 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180309230124.GA17721@amd> Content-Language: en-US X-Authenticated-Sender: lars@metafoo.de X-Virus-Scanned: Clear (ClamAV 0.99.3/24380/Sat Mar 10 10:13:47 2018) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180310_032002_196572_C2B6D62B X-CRM114-Status: GOOD ( 15.37 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: security@kernel.org, ivo.g.dimitrov.75@gmail.com, pmeerw@pmeerw.net, khilman@kernel.org, tony@atomide.com, aaro.koskinen@iki.fi, kernel list , linux-iio@vger.kernel.org, sre@kernel.org, martijn@brixit.nl, =?UTF-8?Q?Filip_Matijevi=c4=87?= , abcloriens@gmail.com, sakari.ailus@linux.intel.com, pali.rohar@gmail.com, knaack.h@gmx.de, clayton@craftyguy.net, linux-omap@vger.kernel.org, patrikbachan@gmail.com, linux-arm-kernel , serge@hallyn.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP On 03/10/2018 12:01 AM, Pavel Machek wrote: [...] >> What file are you opening to cause this? > > Strace says: > > openat(7, "in_intensity_both_thresh_rising_en", >>> O_RDONLY|O_LARGEFILE|O_NOFOLLOW) = 3 > fstat64(3, {st_mode=S_IFREG|0644, st_size=4096, ...}) = 0 > ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbe83b714) = -1 ENOTTY >>> (Inappropriate ioctl for device) > read(3, > Message from syslogd@localhost at Mar 9 23:54:39 ... > kernel:[ 3097.357696] Internal error: Oops: 80000007 [#2] ARM > > So that would be: > > ./devices/platform/68000000.ocp/48072000.i2c/i2c-2/2-0029/iio:device1/events/in_intensity_both_thresh_rising_en > > And indeed, manually cat-ing that file reproduces the problem. > > pavel@n900:/sys/devices/platform/68000000.ocp/48072000.i2c/i2c-2/2-0029/iio:device1$ > cat name > tsl2563 > > I can not find tsl2563 in MAINTAINERS, file is > ./drivers/iio/light/tsl2563.c . I added few people pointed by git log. The driver registers event attributes, but does not provide a handle to access those attributes. Now the question is how to best handle this case. 1) Return an error when the device is registered and abort registration 2) Skip registering the event attributes 3) Skip registering the event attributes, but print a warning 4) Register the attributes, but return an error when they are accessed I'd prefer 2 since it offers a nice method of disabling all events for a device (e.g. if not interrupt is provided). On the other hand it could cause some confusion during development, potentially causing the developer to wonder why he doesn't get any event attributes even though he setup his channel description to have event attributes. Patch for 2. Tested-by: Pavel Machek Reported-by: Pavel Machek --- a/drivers/iio/industrialio-event.c +++ b/drivers/iio/industrialio-event.c @@ -477,7 +477,8 @@ int iio_device_register_eventset(struct iio_dev struct attribute **attr; if (!(indio_dev->info->event_attrs || - iio_check_for_dynamic_events(indio_dev))) + iio_check_for_dynamic_events(indio_dev)) || + !indio_dev->info->read_event_config) return 0; indio_dev->event_interface =