Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp1545303lqt; Sat, 8 Jun 2024 02:51:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU1XUKpfz95cvCvvWShB54yZvU9OcGP8KPa3qEjXmiG8qtInJjnagsqKWm5UiOXPDC55oe0of/N8iIW0aCeC2zfGLz00jDZ9FOI1oGc5Q== X-Google-Smtp-Source: AGHT+IFXNan5JIJQBQIL0A86Hv2u4oVA2hCr2r4yakYS2I05ZRTrXmPNSPDh4BQbvMG5FmpDRI2E X-Received: by 2002:a17:903:1212:b0:1f6:6dc9:615c with SMTP id d9443c01a7336-1f6d02f4e65mr52531375ad.35.1717840283574; Sat, 08 Jun 2024 02:51:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717840283; cv=pass; d=google.com; s=arc-20160816; b=i3sX22X/j1tI12G9/bV5xn6VyFncGdsgyT+tJSzE8oXTIxvxJVWBVNq+Sw+DXyadAF IDFDAb5faObJ6ExgZgkVlO4kYy6Rq3QfajVirHtpRk5o/N54Iph7qGTAWYR67DHFXZQv EO5R2KoaKXnkuY7KIN+IVvfSvAN7JkA8zRxZlmpNIEYOnBO7Sqr8QEde+6krHTrrl2wF Ebc+BNfd0MEXaYvAWVCkev5nSBzTrfRaD7qvTqNgMa5x9Et3srTvw/hVSmfJTcoBrCAv JVbIdWpsHEN35dNvYoeuIOfLYJ4hyUae0hUxWIoQD+uA8uvaHwHmM7XFcRG/qeWJMt06 4Log== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:date:from; bh=zox9GUYzNZYOkniZsRKovHXNaExWA7MgB/uQ/r8geVk=; fh=utfQjCkRahwr7cibaYmIJMwet5QEVICWGR1rhV9cjSw=; b=llxQvMmcAlgWN3CE3wMPKGlrcDaq9VT7LpnxQrTV8OI5RTB9cRdj8lb0UImYWbrATB 8lP/HAPOZoadzrDayQfHV5YlYq5JxflCJBQNMuE1cuJMjaTbN8jORC6kayTUdhiSUKzg Qk8oPUC54Cy1+MChbySk7a1tZJFURFJV8zjKo3NPnqvqhVhh04ctP467E5QDjLdvvT3r uGg5aTatnB8n/OmaozoSNpS5CAcCP/RkYqj6cMuXD1Zd0sDr0L2WPjcd0GgCeRw2j+Ux Wm1kUy8w+bWZNIgtbkuLvjGmK6tanzHiXBhLosfp7jlbUyXFAcmF48c4cqYV/x6MHgFa uF0A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-207001-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207001-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d9443c01a7336-1f6bd7d2f68si45677845ad.238.2024.06.08.02.51.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Jun 2024 02:51:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-207001-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-207001-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207001-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 45272B2198A for ; Sat, 8 Jun 2024 09:51:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 662F4176FCE; Sat, 8 Jun 2024 09:51:07 +0000 (UTC) Received: from fgw21-7.mail.saunalahti.fi (fgw21-7.mail.saunalahti.fi [62.142.5.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 543CF1EB40 for ; Sat, 8 Jun 2024 09:51:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.142.5.82 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717840266; cv=none; b=Pnx+GiLKDOIQcbNudIMrh1VE4NurlKS3I/bZn+pJYBKJnp10wvwfOedJmuB0ufiCdzAp4z+rjOzz+rom6s4uXX2diQqKRGXztbxzOy2pR8sY6c5Q2nv+TMKob9aPVnFfUbnODPDgv8trFszQOppv+taTIk5jMV7ZTCck2tHOmuE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717840266; c=relaxed/simple; bh=D/jB0XgeuTal8IdtuQ9W6D7Q5suMcgKwNYSpOc0QwWg=; h=From:Date:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=A5NE+jFuBa8jhtECmTJBgRw+0wBDyDbNlqyrScGgB1XmPF86PEh0/8dq3k56d50RAB7msVs3zT784ogvrJ2GYv1y+uKUytAGpwUdpYFe9F9yQ4916wgl2XPMzWyAyRsZRUbiRAcBvODXl8ODKREiWZavuHtsbSPPbiiGrn7foWQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com; spf=fail smtp.mailfrom=gmail.com; arc=none smtp.client-ip=62.142.5.82 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=gmail.com Received: from localhost (88-113-26-230.elisa-laajakaista.fi [88.113.26.230]) by fgw20.mail.saunalahti.fi (Halon) with ESMTP id 9e1bbe5b-257c-11ef-8d59-005056bd6ce9; Sat, 08 Jun 2024 12:51:03 +0300 (EEST) From: Andy Shevchenko Date: Sat, 8 Jun 2024 12:51:02 +0300 To: Crescent Hsieh Cc: Jiri Slaby , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Subject: Re: [PATCH 5/6] tty: serial: 8250: Add support for Moxa PCIe boards to switch interface Message-ID: References: <20240607114336.4496-1-crescentcy.hsieh@moxa.com> <20240607114336.4496-6-crescentcy.hsieh@moxa.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240607114336.4496-6-crescentcy.hsieh@moxa.com> Fri, Jun 07, 2024 at 07:43:35PM +0800, Crescent Hsieh kirjoitti: > This patch adds support for Moxa PCIe serial boards to switch the serial > interface by using ioctl() command "TIOCSRS485" with the flags of struct > "serial_rs485": > > - RS232 = (no flags are set) > - RS422 = SER_RS485_ENABLED | SER_RS485_MODE_RS422 > - RS485_2W (half-duplex) = SER_RS485_ENABLED > - RS485_4W (full-duplex) = SER_RS485_ENABLED | SER_RS485_RX_DURING_TX > ... > + if (rs485->flags & SER_RS485_ENABLED) { > + if (rs485->flags & SER_RS485_MODE_RS422) > + mode = MOXA_RS422; > + else if (rs485->flags & SER_RS485_RX_DURING_TX) > + mode = MOXA_RS485_4W; > + else > + mode = MOXA_RS485_2W; > + } else { > + if (!(pci_moxa_supported_rs(dev) & MOXA_SUPP_RS232)) } else if ... { > + return -ENODEV; > + } ... > + if (pci_moxa_is_pcie(dev->device) || pci_moxa_is_mini_pcie(dev->device)) { > + if (pci_moxa_supported_rs(dev) & MOXA_SUPP_RS485) { Two if:s can be replaced with if (foo && bar), but it's up to you. > + port->port.rs485_config = pci_moxa_rs485_config; > + port->port.rs485_supported = pci_moxa_rs485_supported; > + > + if (!(pci_moxa_supported_rs(dev) & MOXA_SUPP_RS232)) > + port->port.rs485.flags = SER_RS485_ENABLED | SER_RS485_MODE_RS422; > + } > + } -- With Best Regards, Andy Shevchenko