Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp765139ybg; Wed, 23 Oct 2019 05:38:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqzg45XYm5azGoPPRhza5dcgKWkntZHcgMHtvEZUYMTP7tNps6t8pKR6RX/1TLL9EL7fEuBf X-Received: by 2002:a17:906:1942:: with SMTP id b2mr32664128eje.36.1571834334438; Wed, 23 Oct 2019 05:38:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571834334; cv=none; d=google.com; s=arc-20160816; b=HqmVb4bbtK7CDU8VafCg2XKxaMZSupEembQYVNh7oM2PeyPEfCD8KrUcv9trZnIUwr w43lhcgXLs9oDWtn23mM7Brbpf2MTc73Onjks7dkkUhKEDG9Oc2N1fs5brCRYK0fYhss LmRDPoCgTbrBW2L+ClBG7cw9Ot0pwSZgaFVtmmzFP2z5zF5+RDwlY3uDbL4VZBfxn5u1 7qaBdgTwAZ0OO4TBM9ot2TxKDEnBZmsrYKYxQjop6GOMoM2AKKmRjLATa9gJbfTO2zaY WWsWho8NC3w0eHw81fk3Cs+XZtBVykEdTurxqOLbMUtCu76t6zdfms4qP8NJ0DQ64MGL 5/hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=aEL8gJRKlNCh14212TGGz6HxJarOVxQCTWxzIntZ7Hs=; b=BxxXo7+JKwHBzhCitI+SMB69A6GCVjOFfc2kZHU7NSd3jSuatq8cgmwfHtzMjq5apn 6vDjorqfvsFwhSoI9XzIgU9mz73z6ZdsPlkUiZyTDuaghLEpgPqNmfURz6+lDeduYn5d 5lzGJX9WUs/Jkdu1sonYFNOEnnm02yzcZBr1ZYcH9M1kQ3CBOcUhqs4u7dva4TFqAAwy Y0DFOsOqkCUnkKr34E+QnplO/Bkw595tFcG/13Wz7+zx4F9gcW3qEmMSzSuIyiCtZ5Tv 4YEHW47lR1wZ1Dmp7SieatQ4NtALgoH98fbi/XPYyoQaBFEfi6N/id7m6pKfuo6XQrut 8y/w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y16si12406777ejc.34.2019.10.23.05.38.30; Wed, 23 Oct 2019 05:38:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390775AbfJWJPP (ORCPT + 99 others); Wed, 23 Oct 2019 05:15:15 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:43681 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390314AbfJWJPO (ORCPT ); Wed, 23 Oct 2019 05:15:14 -0400 Received: by mail-lf1-f66.google.com with SMTP id 21so6485837lft.10; Wed, 23 Oct 2019 02:15:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=aEL8gJRKlNCh14212TGGz6HxJarOVxQCTWxzIntZ7Hs=; b=HBs+mR4cUcG4sdmFNaXCJpUZkVqFEcQp4US48ITK9+r3jv9/rCc+xZP2048FlJLjjn wpLbX9yK/JhPe+tEdTtwK1OoJo1gPXM/eUTgDOLs49NmJJSk5TwJ+P66OfmvNvpIwESR 0JK6xeoTw6A8xF54kHVZBe8wdWXGVVhhVyWi3tm2T2lqJ3C4eu6daiJKqlnEI6KIIM9X qnam6hW9eB7L3CtwDWzVrb7t9z5eYhLpNK5xioYUmMg6ghqdcIIpplatgBpNkb8ypbOs x2oAD39ADZ3RYrvbFtMAsyC2IcmfLGv3kYMo+Ogv260J0AEnlonQEJfHmSBNJ4cfJVoS GE7A== X-Gm-Message-State: APjAAAXFrLrIaD4PBNYwwrLbWtYw4qdIN++Y7tkt/11EWUinpdDqQem6 8RfgJqWOXoPuf5hElwVNtBo= X-Received: by 2002:ac2:4847:: with SMTP id 7mr21368771lfy.180.1571822112594; Wed, 23 Oct 2019 02:15:12 -0700 (PDT) Received: from xi.terra (c-51f1e055.07-184-6d6c6d4.bbcust.telenor.se. [85.224.241.81]) by smtp.gmail.com with ESMTPSA id x16sm743625ljd.69.2019.10.23.02.15.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Oct 2019 02:15:11 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.92.2) (envelope-from ) id 1iNCjo-0006Un-8m; Wed, 23 Oct 2019 11:15:28 +0200 Date: Wed, 23 Oct 2019 11:15:28 +0200 From: Johan Hovold To: "Ji-Ze Hong (Peter Hong)" Cc: johan@kernel.org, gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, peter_hong@fintek.com.tw, "Ji-Ze Hong (Peter Hong)" Subject: Re: [PATCH V2 2/7] USB: serial: f81232: Add tx_empty function Message-ID: <20191023091528.GQ24768@localhost> References: <20190923022449.10952-1-hpeter+linux_kernel@gmail.com> <20190923022449.10952-3-hpeter+linux_kernel@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190923022449.10952-3-hpeter+linux_kernel@gmail.com> User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 23, 2019 at 10:24:44AM +0800, Ji-Ze Hong (Peter Hong) wrote: > Add tx_empty() function for F81232. > > Signed-off-by: Ji-Ze Hong (Peter Hong) > --- > drivers/usb/serial/f81232.c | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > > diff --git a/drivers/usb/serial/f81232.c b/drivers/usb/serial/f81232.c > index c07d376c743d..b42b3738a768 100644 > --- a/drivers/usb/serial/f81232.c > +++ b/drivers/usb/serial/f81232.c > @@ -685,6 +685,23 @@ static void f81232_dtr_rts(struct usb_serial_port *port, int on) > f81232_set_mctrl(port, 0, TIOCM_DTR | TIOCM_RTS); > } > > +static bool f81232_tx_empty(struct usb_serial_port *port) > +{ > + int status; > + u8 tmp; > + > + status = f81232_get_register(port, LINE_STATUS_REGISTER, &tmp); > + if (status) { > + dev_err(&port->dev, "get LSR status failed: %d\n", status); > + return false; You need to return true here on errors like the other drivers do (consider a disconnected device where you end up with -ENODEV here). > + } > + > + if ((tmp & UART_LSR_TEMT) != UART_LSR_TEMT) > + return false; > + > + return true; > +} Johan