Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp893557iog; Mon, 13 Jun 2022 15:33:38 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vViFILccGKssWJVeI7BXCpeW9LfBQ64yDE0A3qq9bE8wDcoS7/VFxLJ/+NMaoCTK69nxfL X-Received: by 2002:a17:903:1c8:b0:167:67ff:323d with SMTP id e8-20020a17090301c800b0016767ff323dmr1213697plh.22.1655159618232; Mon, 13 Jun 2022 15:33:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655159618; cv=none; d=google.com; s=arc-20160816; b=TLZADdJF+OJxbGTBZEGrIb2xrK5Sn78MI+mpCbNhIefloXEcMfaE3FJAhgviBvjp+U PMxIzB1jK//H7fWAge15M+cOBIuzaBFFPZvgqrx7PyrIW3UUfFcCz0HgOKpBgo4i3vCZ XTs8aIVVYFG7ro4lvlJEJa+8RaPKwlx+GjXK2Nv9tNAZkF2ewnAouOfe62WDWAqiiU8h yy5B58uoaAmW4VB3ttE08orYZGvATNSMGhM4YknG8taYNqtarXK3f7jKCC3B9a4XzZvj p6UZw10+f69kiK0rJRf5E6BWthKmPwdaVwkm4qfLbrsj1HuyexznapB7ipcp+jQycjn2 X6KA== 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:from:references :cc:to:subject:dkim-signature; bh=MoLoDkMs6I8XGsKEVj5fJOcypR8PRE0J+gMLMY9apjE=; b=m2ABBFQLOxfytGXgfr9wyw+qZXwoynIQyZraCU6G/897e5xTjt8k0UbZ1Fe3zWwlyy j4A8Ig0DOhZNS7O0w7jSP8RGTr7c3aT5JDtkwKcMt00MASfYDx207XSEOKj8Zht4nj2Y jzY4hPs4q5yq0D71Sae2ukxUX+l5Ukb3Gt+BeyME5mgglPoMcvm/F4AyKYjM3+KHGSfC yQyyjb8EymRY77r0g5jFPzYqf2eyKy0PBmA9Fh+IxFPqKzGjnqR9CK3TxxTk5sGXiTAn XsVY32wHOsE47CJo7WccLCoYm5l6VrLM0S+th48HP0ifcUq3ekXxWnxVf9nr2SWWB8UA TGUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=bqJRkVrf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmx.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f131-20020a636a89000000b003fcea910b03si11123710pgc.523.2022.06.13.15.33.26; Mon, 13 Jun 2022 15:33:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=bqJRkVrf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239335AbiFMWWx (ORCPT + 99 others); Mon, 13 Jun 2022 18:22:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236264AbiFMWWo (ORCPT ); Mon, 13 Jun 2022 18:22:44 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B87F96342; Mon, 13 Jun 2022 15:22:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1655158932; bh=/K38MCAmHWxqyV1M9IU8mCPprustLYV8uXAeCmwAeEQ=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=bqJRkVrfmrxiWp4dHM+lZQYZYWy4oUodCG5GQOBxWKeiD9v2xehtL/oXUA92CTC5u UEwDXKvqlCKD6fcpx2lBqW2I+mUBDxkmW6IxjRVZgunZZMgc2QHLBjjMDs8hJns0gd UsD2FP3cG2SEpgE3Fp8kSsDtrtvAMLfSAdKXk4XE= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.0.33] ([46.223.3.220]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MhlKs-1nVvLI0TwG-00drMA; Tue, 14 Jun 2022 00:22:12 +0200 Subject: Re: [PATCH v6 5/6] serial: Support for RS-485 multipoint addresses To: =?UTF-8?Q?Ilpo_J=c3=a4rvinen?= , linux-serial@vger.kernel.org, Greg KH , Jiri Slaby , Jonathan Corbet , Arnd Bergmann , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org Cc: Andy Shevchenko , Lukas Wunner , =?UTF-8?Q?Uwe_Kleine-K=c3=b6nig?= , linux-api@vger.kernel.org References: <20220613075227.10394-1-ilpo.jarvinen@linux.intel.com> <20220613075227.10394-6-ilpo.jarvinen@linux.intel.com> From: Lino Sanfilippo Message-ID: Date: Tue, 14 Jun 2022 00:22:10 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20220613075227.10394-6-ilpo.jarvinen@linux.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:qnVCycgo6Woco+A3lDsqIOO1oP7H1X4CPI8yz97JmGIl88WWKr0 w9veZfbN+pE+xEqp+BlWuETwaVnzMVZDlca/2HiEABVfIsJC4cTm8uNC+2s445Ze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CTOgE/hU63f2HD8UNIdApMbvqyc/+NT+y0k zgHocbKY2VqXmOT3t5pJwlIshrk6fJ0z6UBUE5PRQoPremSjFmmy94XE0ik/w0T44eSjO60aj 1+Ox5B2+lEySItRi0xhtv9k6vaxeuoqVpZgL1lHerbLRxVXQI/UGOLUd/xnl2s7kQGXbNBube 61VGT7urLlqHAQadzgyz0Xfn5f1digeRTQ9fXNiXKGSjUXiGvzCxJUXag== X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FROM,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, there are some typos in the documentation and comments (see below). On 13.06.22 at 09:52, Ilpo J=C3=A4rvinen wrote: > -5. References > +5. Multipoint Addressing > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D > + > + The Linux kernel provides addressiong mode for multipoint RS-485 ser= ial addressiong -> addressing > + communications line. The addressing mode is enabled with SER_RS485_A= DDRB > + flag in serial_rs485. Struct serial_rs485 fhas two additional flags = and fhas -> has > + fields for enabling reveive and destination addresses. reveive -> receive > + > + Address mode flags: > + - SER_RS485_ADDRB: Enabled addressing mode (sets also ADDRB in termios= ). > + - SER_RS485_ADDR_RECV: Receive (filter) address enabled. > + - SER_RS485_ADDR_DEST: Set destination address. > + > + Address fields (enabled with corresponding SER_RS485_ADDR_* flag): > + - addr_recv: Receive address. > + - addr_dest: Destination address. > + > + Once a receive address is set, the communication can occur only with= the > + particular device and other peers are filtered out. It is left up to= the > + receiver side to enforce the filtering. Receive address will be clea= red > + if SER_RS485_ADDR_RECV is not set. > + > + Note: not all devices supporting RS485 support multipoint addressing= . > + > +6. References > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > [1] include/uapi/linux/serial.h > diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/seria= l_core.c > index 76bb1b77b06e..bc18018e8d4b 100644 > --- a/drivers/tty/serial/serial_core.c > +++ b/drivers/tty/serial/serial_core.c > @@ -1294,6 +1294,17 @@ static int uart_check_rs485_flags(struct uart_por= t *port, struct serial_rs485 *r > if (flags & ~port->rs485_supported->flags) > return -EINVAL; > > + /* Asking for address w/o addressing mode? */ > + if (!(rs485->flags & SER_RS485_ADDRB) && > + (rs485->flags & (SER_RS485_ADDR_RECV|SER_RS485_ADDR_DEST))) > + return -EINVAL; > + > + /* Address gived but not enabled? */ gived -> given Regards, Lino