Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp3438723pxy; Tue, 4 May 2021 02:07:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpJiiOJdj/YDqUWASQS2a2A+FGiam+z1qhmzunuQn/tnwJ8P0ONSfa08no7Ia0cxZ4ue5B X-Received: by 2002:a17:902:ee94:b029:ed:4204:5e44 with SMTP id a20-20020a170902ee94b02900ed42045e44mr24775845pld.60.1620119258944; Tue, 04 May 2021 02:07:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620119258; cv=none; d=google.com; s=arc-20160816; b=ZUE2rZpnLY+aZK5RQcgj3KX9c8nrPUDE6I+x5KeNQWVnw6czKpY6Leho9/moOLIgiW YKcgNSZZKJ3THFKvwH7f45LqVLy3AqrtQSMOd7FJIVKI5pO6lkksT4T1ZzLrV14kGGf7 KC8mDgoPH3y12csJy5jVLv0gRxsU6r/OqtZsPeFCq/aLGDawTN1UjwIXI5itZ2T4nc6a QBG9K2f1VfG3MRiiA95+8OAmSt69tiBhSla4i4FUdJ8qx0Byve8BZLyZrY8A+DVliE/P eqIZ5ZphBCgcjJiyUuzzRMUDsHLpfoQ0MZAW1BJj7BHMd2hF4gYiYmwBCNu/XIySDXLJ +fQQ== 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:cc:to:subject:from:date; bh=/30e/K7rXwtLayBsNPMIhcvDegoqiN3bGbGsKnO25u8=; b=VgbAl89t+0BD3NLrDOoZBmsODYIKXuTRhGfHhtRvf29TrR8g/XqeYKRCzo1g/IM6MW 4F8uldJwyQUm81I95QkwKOjNz+F8XLlJmJ5/SG/0+Vryp3dGsObo0EKrbmKAblr9VlsW hgGxPzfoOfDaiR7S/KtTZBDOxfsydy47faKlYPX/T7u35ev2xB7oU3Yt0JtPEAYxPW92 fNErWD4b4um/XBEQDpQCMphhWTxnsvkkFJsJW4hKf4M/bYj7u5nkNWdEDg/FRbwBRKTB niwETjaIRzCJFaUYrZp5HQuv/PUSGU3xj/MCtrmqIp13oSZgLstiNJXwjezgjpoVfqBe Ei+g== 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=fail (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b15si2929786pga.98.2021.05.04.02.07.25; Tue, 04 May 2021 02:07:38 -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=fail (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230149AbhEDJGB convert rfc822-to-8bit (ORCPT + 99 others); Tue, 4 May 2021 05:06:01 -0400 Received: from aposti.net ([89.234.176.197]:34686 "EHLO aposti.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230130AbhEDJFy (ORCPT ); Tue, 4 May 2021 05:05:54 -0400 Date: Tue, 04 May 2021 10:04:24 +0100 From: Paul Cercueil Subject: Re: [PATCH] iio: core: return ENODEV if ioctl is unknown To: Alexandru Ardelean Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, jic23@kernel.org, lars@metafoo.de, Linus Walleij , Nuno Sa Message-Id: In-Reply-To: <20210503144350.7496-1-aardelean@deviqon.com> References: <20210503144350.7496-1-aardelean@deviqon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le lun., mai 3 2021 at 17:43:50 +0300, Alexandru Ardelean a ?crit : > 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 Tested-by: Paul Cercueil Thanks! -Paul > --- > 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); > -- > 2.31.1 >