Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3915978pxb; Tue, 2 Nov 2021 00:19:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZIeLnbTQKu2BeCYj0/VRo0gxWoG9QpA88b+7f/camHaBAeo/SDIclHkIQbSmK2aRp1Q6Z X-Received: by 2002:a05:6602:2dd5:: with SMTP id l21mr8281282iow.87.1635837587816; Tue, 02 Nov 2021 00:19:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635837587; cv=none; d=google.com; s=arc-20160816; b=BzbHCp+cuhWLBphuqTMW3Epk53ndIQjI+eY/nYyxnHtwes5DGHoRdYDulNHYjUFuea CjkoZJz7d0c8Rf9oA7QBg5dFTZqX6y+Q6y3Q8XIcXu4SjLqkAXCwokXXP5pdudokqJw5 BIfDEfZ+tBwxdqfV0T6f7spcqH6ulpBWVuAN2PEQ3hTYW6MlOL4PJ70INMCoD2K9W/WA 36zSrrHH4PXwaeOAzYc+I0Zv36+/DM8k2RHEePphUScF7V1jpL/U0xOzD8xKnGhdyK2/ v+Asm6YRRVgHTOvDfK26e/1YSTeW9f/4ED/7MxPu2LQaw93iiWP54nnqOqAlHocijDbt kzuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:references:cc :to:subject:from:dmarc-filter:sender:dkim-signature; bh=y6Sz6xkt/HSEuNS0flTXHuzKjPeOjD94Xhcr7nenToU=; b=j5a7eBndfmcAhKVjA+txFFxcKFqxrpAzFxKz0AJCJW2COi1L7mamyxSOnqx0hiQb2f 7jBs+5Rjk61lsT/sMUP+mtSRDrC8mxwXMPhMCZUoOqbIKdNFOR+nSCxZKu15NiRtvMdD 6yMa9LeoqTyNuk74wG7z1O5lUSgPzVVMyyMN2sjiTZvaVrJuCE/ynS5gX2JGKq8s+Ixr LvaAVGa96FEDf54mX3iJXthSuvhVXqGPaqgmH4fZJQkobZpVNMyMQe03Vvb/LmNCZRup 9vvJ2Nag/F8+GFosG8uQ4ZWxhEizzScLG0oRq+zccNUPFX4i3lmv29wycxn8tEjYoX05 FuYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=S5lSnoZa; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x8si843202ilv.176.2021.11.02.00.19.36; Tue, 02 Nov 2021 00:19:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=S5lSnoZa; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230321AbhKBHVl (ORCPT + 99 others); Tue, 2 Nov 2021 03:21:41 -0400 Received: from so254-9.mailgun.net ([198.61.254.9]:15259 "EHLO so254-9.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231145AbhKBHVk (ORCPT ); Tue, 2 Nov 2021 03:21:40 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1635837546; h=Content-Transfer-Encoding: Content-Type: In-Reply-To: MIME-Version: Date: Message-ID: References: Cc: To: Subject: From: Sender; bh=y6Sz6xkt/HSEuNS0flTXHuzKjPeOjD94Xhcr7nenToU=; b=S5lSnoZa0VrENqPxzaTyYk5IFGMK+ZCAEOHmZXavKSw2orC1G/v0TWNaAGuIGty0XcGZmX5H 4BJSjnY/Zsd0FH8DXgrGmWYOLoDsr/Bt+IL7mVmmhF0FWW2rBf0f9UJnry8xEK9dqLO4lK6a myWB3rYcrjlNUMvKIWxLfRAqDjM= X-Mailgun-Sending-Ip: 198.61.254.9 X-Mailgun-Sid: WyI2MTA3ZSIsICJsaW51eC1ibHVldG9vdGhAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n04.prod.us-west-2.postgun.com with SMTP id 6180e65caeb239055603ddb7 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 02 Nov 2021 07:18:52 GMT Sender: zijuhu=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 56A90C4338F; Tue, 2 Nov 2021 07:18:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.4 required=2.0 tests=ALL_TRUSTED,BAYES_00, NICE_REPLY_A,SPF_FAIL autolearn=unavailable autolearn_force=no version=3.4.0 Received: from [192.168.0.104] (unknown [183.195.15.125]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: zijuhu) by smtp.codeaurora.org (Postfix) with ESMTPSA id 28A10C4360C; Tue, 2 Nov 2021 07:18:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.codeaurora.org 28A10C4360C Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=codeaurora.org From: Zijun Hu Subject: Re: [PATCH v1] serdev: Add interface serdev_device_ioctl To: Greg KH , Marcel Holtmann Cc: robh@kernel.org, jirislaby@kernel.org, linux-serial@vger.kernel.org, Linux Kernel Mailing List , linux-bluetooth , Zijun Hu References: <1635753048-5289-1-git-send-email-zijuhu@codeaurora.org> <573d3640-2e8b-9266-4205-755ac0951abd@codeaurora.org> Message-ID: <787fa2b6-146a-16b1-e304-c7e3b26dbf99@codeaurora.org> Date: Tue, 2 Nov 2021 15:18:46 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org On 11/1/2021 7:54 PM, Greg KH wrote: > On Mon, Nov 01, 2021 at 12:45:36PM +0100, Marcel Holtmann wrote: >> Hi Greg, >> >>>>>>>> For serdev_device which is mounted at virtual tty port, tty ioctl() >>>>>>>> maybe be used to make serdev_device ready to talk with tty port, so >>>>>>>> add interface serdev_device_ioctl(). >>>>>>>> >>>>>>>> Signed-off-by: Zijun Hu >>>>>>>> --- >>>>>>>> drivers/tty/serdev/core.c | 11 +++++++++++ >>>>>>>> drivers/tty/serdev/serdev-ttyport.c | 12 ++++++++++++ >>>>>>>> include/linux/serdev.h | 9 +++++++++ >>>>>>>> 3 files changed, 32 insertions(+) >>>>>>>> >>>>>>>> diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c >>>>>>>> index f1324fe99378..c0f6cd64716b 100644 >>>>>>>> --- a/drivers/tty/serdev/core.c >>>>>>>> +++ b/drivers/tty/serdev/core.c >>>>>>>> @@ -405,6 +405,17 @@ int serdev_device_set_tiocm(struct serdev_device *serdev, int set, int clear) >>>>>>>> } >>>>>>>> EXPORT_SYMBOL_GPL(serdev_device_set_tiocm); >>>>>>>> >>>>>>>> +int serdev_device_ioctl(struct serdev_device *serdev, unsigned int cmd, unsigned long arg) >>>>>>>> +{ >>>>>>>> + struct serdev_controller *ctrl = serdev->ctrl; >>>>>>>> + >>>>>>>> + if (!ctrl || !ctrl->ops->ioctl) >>>>>>>> + return -EOPNOTSUPP; >>>>>>> >>>>>>> Wrong error for returning that an ioctl is not handled :( >>>>>> checkpatch.pl always reports below WARNING when i use ENOTSUPP as present interfaces >>>>>> do. so i change error code to EOPNOTSUPP. >>>>>> >>>>>> #28: FILE: drivers/tty/serdev/core.c:412: >>>>>> + return -ENOTSUPP; >>>>>> >>>>>> WARNING: ENOTSUPP is not a SUSV4 error code, prefer EOPNOTSUPP >>>>> >>>>> Both of them are not the correct error to return when an ioctl is not >>>>> supported. >>>>> >>>> is ENODEV okay? >>> >>> No, -ENOTTY is the correct one as per the documentation, right? >>> >>>>>>> Anyway, what in-tree driver needs this functionality? Why does serdev >>>>>>> need any ioctl commands? >>>>>>> >>>>>> i am developing driver for a special bluetooth controller which is integrated within SOC, >>>>>> and it does not connect with the BT HOST with UART as normal controller do, but it has very >>>>>> similar features as the BT controller with UART I/F. it is mounted on a virtual serial port >>>>>> driven by a tty driver developed. but it need to call tty ioctl to make the >>>>>> special BT controller ready to talk with tty port. so i add this interface. >>>>> >>>>> Please submit this change when you submit your driver that uses it at >>>>> the same time so we can review them all at once. We do not add apis >>>>> that are not used in the kernel tree. >>>>> >>>> okay >>>>>> as you known, the main purpose of ioctl is to achieve MISC and irregular control. so it is useful >>>>>> for these irregular devices. >>>>> >>>>> For tty devices, "custom" ioctls are not ok, use the standard tty >>>>> commands and you should be fine for everything you need to do. >>>>> >>>>> If not, then perhaps your design is incorrect? >>>>> >>>> i just want to refer bt_ioctl within https://source.codeaurora.org/quic/qsdk/oss/kernel/linux-ipq-5.4/tree/drivers/soc/qcom/bt_tty.c?h=NHSS.QSDK.11.5.0.5.r2 >>>> by serdev. so add this interface. >>> >>> The 5.4 kernel is not relevant here, so I do not understand. >>> >>>> are there any other good solution to advise? >>> >>> Why not work with the bluetooth developers on this? >> >> if this is just to have some hackish Bluetooth driver, then NAK from my side. Since we have serdev, we have no need for, or requirements for any ioctl anymore. If such thing is needed, it is a bad design. > > Thanks for the confirmation, seems sane to me! > > Zijun, please fix up your driver and submit it to be merged and all > should be fine, no need for any custom ioctls. > thank you Greg, i have submitted all changes to support the special BT controller, certainly, it includes this serdev change. > thanks, > > greg k-h >