Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1127564pxj; Sat, 8 May 2021 08:22:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmbQo2aB+jetGJiC3EQTGDHbFNiBliJgYN9RWMeaCai/qZW/Z29jf1b4roCRqx5OReoj+9 X-Received: by 2002:a5d:97cb:: with SMTP id k11mr12064730ios.204.1620487347920; Sat, 08 May 2021 08:22:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620487347; cv=none; d=google.com; s=arc-20160816; b=WmEjDTsUDgOHBxH+46app/jCQ/nl2dtcOMHt1stpv7YNWjvY7M/ABc4UV9qYKDaF5h lFr/1ZxW8mMK8qCahfeliXYgH42RkwJKia1qRo+W/HP0EI0IvTAHvyrzkgXlJEeR7IaM JFgdNWZNtA8w54OPY/jv8kMEc0MfGf5sZOK2rfh8ATzRNhY8yntP5rH+sL4nH7ZLQ0lA xYQY/AkyfuwNak9tZFQLPivtlld9hVf4kqkJPnsd1eV0eA53Z0g8xusMuaOHQvkJtg8R phcYAJY2qbrvpSKo5cdm5LaZ8vHFDJtg+h82Gq71PMeR+rtWsIAJMeBwU4V+2SzLYiTZ /fuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=x47hT/3crlgpcJlCQh3GTGJ3FqKQdjS2XTmeqVuD/KY=; b=KajS2otjBDO86FxVWXDfs5Q2Cl+zHtx3j/Spm8fcDGwCAQz9Bdd8ogMWp7RV5bMk0m vFe33vcAfP4SlZlKAhpelw3GEnj+Lf9W32V8kPSSDPwT4tmGBOg1iqt5NPKV8+jSQ6aY PAfaEBkP08xzb0Rb66Ap8eIWbOmnn7sJhCPdiFCP/IPAavyaxqzTxNw5+6TT2uU25vOM ejciyNwW9/uvdt41MbZY8bjdFDt1hqH1/QL3Sx5n8ybgQ3NRlQPnOJdMbqfPmCItzMQa ZsXabbimWU42fx9mc4FKPn0y2lVCqsQ13U82k0sbJnTPmRXKr5VlqELjZayEnSA+jwQj 1SsQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l15si5147267jaj.81.2021.05.08.08.21.48; Sat, 08 May 2021 08:22:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229559AbhEHPQt (ORCPT + 99 others); Sat, 8 May 2021 11:16:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:51762 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229500AbhEHPQt (ORCPT ); Sat, 8 May 2021 11:16:49 -0400 Received: from jic23-huawei (cpc108967-cmbg20-2-0-cust86.5-4.cable.virginm.net [81.101.6.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5A0B2613F2; Sat, 8 May 2021 15:15:45 +0000 (UTC) Date: Sat, 8 May 2021 16:16:43 +0100 From: Jonathan Cameron To: Alexandru Ardelean Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, lars@metafoo.de, Linus Walleij , Paul Cercueil , Nuno Sa Subject: Re: [PATCH] iio: core: return ENODEV if ioctl is unknown Message-ID: <20210508161643.5990ec15@jic23-huawei> In-Reply-To: <20210503144350.7496-1-aardelean@deviqon.com> References: <20210503144350.7496-1-aardelean@deviqon.com> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 3 May 2021 17:43:50 +0300 Alexandru Ardelean wrote: > When the ioctl() mechanism was introduced in IIO core to centralize the > registration of all ioctls in one place via commit 8dedcc3eee3ac ("iio: > core: centralize ioctl() calls to the main chardev"), the return code was > changed from ENODEV to EINVAL, when the ioctl code isn't known. > > This was done by accident. > > This change reverts back to the old behavior, where if the ioctl() code > isn't known, ENODEV is returned (vs EINVAL). > > This was brought into perspective by this patch: > https://lore.kernel.org/linux-iio/20210428150815.136150-1-paul@crapouillou.net/ > > Fixes: 8dedcc3eee3ac ("iio: core: centralize ioctl() calls to the main chardev") > Cc: Linus Walleij > Cc: Paul Cercueil > Cc: Nuno Sa > Signed-off-by: Alexandru Ardelean This is going to be a little messy to apply as lots of churn in that file. What I've done for now is pulled the fixes-togreg branch forwards onto current staging/staging-linus but I'll do that again after staging/staging-linus moves onto an rc1 or similar base. Anyhow, applied to that tree which is going to have more than it's normal share of rebases this cycle. Thanks, Jonathan > --- > drivers/iio/industrialio-core.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c > index efb4cf91c9e4..9a3a83211a90 100644 > --- a/drivers/iio/industrialio-core.c > +++ b/drivers/iio/industrialio-core.c > @@ -1803,7 +1803,6 @@ static long iio_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) > if (!indio_dev->info) > goto out_unlock; > > - ret = -EINVAL; > list_for_each_entry(h, &iio_dev_opaque->ioctl_handlers, entry) { > ret = h->ioctl(indio_dev, filp, cmd, arg); > if (ret != IIO_IOCTL_UNHANDLED) > @@ -1811,7 +1810,7 @@ static long iio_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) > } > > if (ret == IIO_IOCTL_UNHANDLED) > - ret = -EINVAL; > + ret = -ENODEV; > > out_unlock: > mutex_unlock(&iio_dev_opaque->info_exist_lock);