Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp658439pxb; Thu, 23 Sep 2021 08:05:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZC8WMND6ub1mla/Yvm52yKUIYYG96EOJkr4t3l7G8Jnk9gguh9q91EzeMg1D/D8l7ZdSW X-Received: by 2002:a2e:7203:: with SMTP id n3mr5752856ljc.195.1632409534284; Thu, 23 Sep 2021 08:05:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632409534; cv=none; d=google.com; s=arc-20160816; b=hU3MYtc6fOMzbrTUoS++gvRW4KoMENRzytqM5h/AFD+3g2nA0mIHITtFjawfnUqZnl jaVAGNEDqfvb6CgwN2CNmWmIfnTq2j/DvWGssf7jdMEzUF8LEoHrxXpyaxeHhLz6Kvur p9VJKNphduRzmTUmYTDXEy4n/MY6fUL3yaSx2B6RZqezwDsgBjtHepbN2+8sdG8yDzmo xPezB+uTWBAEq14TzPA133SDKbm5T58PA/wXxA7PzTyCStyC8QCxxuMcmc9ybL292hiY sTg9FZYFMPe8OR9QQnpQMzmKl9xpxXDLKfK68lQjKf7lY0qDUry8teAJcJVjNIYKlJV2 LdXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=q4gRH54hyaDD54Kr22KWEy0j9CBrwRzateUZbGF35RA=; b=T0i8DFdfpBy81u4H5u8S5itHJ0OUQKl8ub1V9c64bjQtMCxt0Th13tsTPDcnvTX+Qr w8zEyTVL2OZNIe0B1uIPzA2UIR11MENOSM2/y9FJnByJca+Xr02dPRQ0+qlWeFY6+VSx CvDDL6IqtygaryIS6wmeJ1K+01ufnGw2vb2T0MQutVcoLt8JqBG46/PCsfMN2Y2xeZX2 fAubrC8YnrzG3pDI0QrRIsmxn7b0PuZ7XL+eW8E6vZF5R0m5DprEm8GXm8nyWBYrFhQH 8h8hpADKHFzcEqOCqRmnBxfr6fv/tjyEQGCqm8LeP5TM6HwtVmsrU6Rf7D8ab7OOG5Nm jr4Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 g18si5852459edy.214.2021.09.23.08.05.01; Thu, 23 Sep 2021 08:05:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241843AbhIWPEB (ORCPT + 99 others); Thu, 23 Sep 2021 11:04:01 -0400 Received: from muru.com ([72.249.23.125]:36512 "EHLO muru.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241798AbhIWPEB (ORCPT ); Thu, 23 Sep 2021 11:04:01 -0400 Received: from localhost (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id 1CA4580C0; Thu, 23 Sep 2021 15:02:57 +0000 (UTC) Date: Thu, 23 Sep 2021 18:02:27 +0300 From: Tony Lindgren To: Johan Hovold Cc: Greg Kroah-Hartman , Andy Shevchenko , Jiri Slaby , Vignesh Raghavendra , linux-serial@vger.kernel.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/6] serial: core: Add new prep_tx for power management Message-ID: References: <20210921103346.64824-1-tony@atomide.com> <20210921103346.64824-4-tony@atomide.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Johan Hovold [210923 12:46]: > On Tue, Sep 21, 2021 at 01:33:43PM +0300, Tony Lindgren wrote: > > If the serial driver implements PM runtime with autosuspend, the port may > > be powered off for TX. To wake up the port, let's add new prep_tx() call > > for serial drivers to implement as needed. We call it from serial > > write_room() and write() functions. If the serial port is not enabled, > > we just return 0. > > This isn't right. If there's room in the driver buffer, there's no > reason to not accept those characters. Maybe. We might get away with returning zero bytes written in write(). But to me it seems better to stop things early when write is known to not succeed. > It's the drivers responsibility to resume writing when write() is > called and that me need to be done in a runtime resume callback in case > the device is suspended. I think we currently need to return zero bytes written from write() when the serial port is not usable. I don't think we can return a fake number of bytes written from write(). And even if we could return a fake number of bytes written, we could run into issues doing the real write to the serial port. > No need to be patching line disciplines for this. Do you see issues with handling the errors in line disciplines? Regards, Tony