From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753547AbcHXGov (ORCPT ); Wed, 24 Aug 2016 02:44:51 -0400 Received: from mail-pf0-f169.google.com ([209.85.192.169]:34970 "EHLO mail-pf0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752605AbcHXGou (ORCPT ); Wed, 24 Aug 2016 02:44:50 -0400 Subject: Re: [PATCH V9 1/1] usb:serial: Add Fintek F81532/534 driver To: Johan Hovold References: <1464659480-2818-1-git-send-email-hpeter+linux_kernel@gmail.com> <20160822131433.GA32590@localhost> <20160823095056.GI16896@localhost> Cc: gregkh@linuxfoundation.org, One Thousand Gnomes , tom_tsai@fintek.com.tw, peter_hong@fintek.com.tw, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, "Ji-Ze Hong (Peter Hong)" From: "Ji-Ze Hong (Peter Hong)" Message-ID: <3e42b288-2b98-f2aa-2758-321fee4cb65d@gmail.com> Date: Wed, 24 Aug 2016 14:36:51 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <20160823095056.GI16896@localhost> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Johan, Johan Hovold 於 2016/8/23 下午 05:50 寫道: > On Tue, Aug 23, 2016 at 04:23:44PM +0800, Ji-Ze Hong (Peter Hong) wrote: >> Hi Johan, >> >> Johan Hovold 於 2016/8/22 下午 09:14 寫道: > > I'd say it's not worth trying to avoid that extra allocation, and there > will be several further allocations done in the usb_control_msg path > anyway. What you have today (i.e. in v9) is fine. Ok, I'll keep set/get register the same with V9. >>>> + tty_port_num = f81534_phy_to_logic_port(serial, phy_port_num); >>>> + port = serial->port[tty_port_num]; >>>> + >>>> + /* >>>> + * The device will send back all information when we submitted >>>> + * a read URB (MSR/DATA/TX_EMPTY). But it maybe get callback >>>> + * before port_probe() or after port_remove(). >>>> + * >>>> + * So we'll verify the pointer. If the pointer is NULL, it's >>>> + * mean the port not init complete and the block will skip. >>>> + */ >>>> + port_priv = usb_get_serial_port_data(port); >>> >>> Check if the port has been opened here instead, no need to store MSR for >>> an unused port above. >> >> It's useless for MSR & Receive data when port is closed, but we need >> the URB to receive TX empty flag. We may not received TX empty flag >> if we don't process when port is closed. It'll make the port not >> workable. > > But you explicitly clear the xmit fifo on open it seems? > The F81532/534 contains 2 blocks of H/W designs. One is a 16550A compatible UART with 128 bytes FIFO, and another is a USB bridge with DMA to access UART TX/RX FIFO and handle USB protocols. The clear FIFO in f81534_open() is just clean UART TX/RX FIFO, not USB bridge's RAM. So we must keep a read URB for get newest information via USB bridge likes TX empty. I'll try again to re-write the section as you mention, submit on first open(), kill on last close() and test for some times. If had no other issues, I'll apply to next patch, otherwise I'll preserve old method. Thanks for your help. -- With Best Regards, Peter Hong