From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751574AbdFZOvY (ORCPT ); Mon, 26 Jun 2017 10:51:24 -0400 Received: from www.llwyncelyn.cymru ([82.70.14.225]:55818 "EHLO fuzix.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751405AbdFZOvT (ORCPT ); Mon, 26 Jun 2017 10:51:19 -0400 Date: Mon, 26 Jun 2017 15:51:15 +0100 From: Alan Cox To: "Enrico Weigelt, metux IT consult" Cc: linux-kernel@vger.kernel.org Subject: Re: Directly accessing serial ports from drivers w/o TTYs ? Message-ID: <20170626155115.13617ed6@alans-desktop> In-Reply-To: References: Organization: Intel Corporation X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 26 Jun 2017 00:43:12 +0200 "Enrico Weigelt, metux IT consult" wrote: > Hi folks, > > > is there already a way for accessing serial ports from drivers, > w/o having to go through the TTY subsystem ? > > Serdev seems provide a connection between arbitrary TTYs to device > drivers. But this implies always having a TTY for each UART (even if > it's never used outside the kernel). > > Is there any way for accessing uarts more directly ? You can write your own driver for the physical hardware and claim it in your driver. Shouldn't normally be needed except for bizarre cases when a serial link is used for something very non tty like (eg as GPIO lines). Otherwise all the low level tty device locking, queues and interfaces assume there is a tty_struct attached to it, so yes you need a tty struct. Why do you need to do otherwise ? Alan