Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp415227pxf; Thu, 8 Apr 2021 05:56:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3HzzpNlY2fKYYzTIIxZlyH5D9ln4WKMrwYjQD+pe/Nsa7hCw0njEFEtGrniDEPV0m6P+b X-Received: by 2002:a17:906:71c4:: with SMTP id i4mr10268402ejk.134.1617886599354; Thu, 08 Apr 2021 05:56:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617886599; cv=none; d=google.com; s=arc-20160816; b=tgvo8sPdUuh4StRPUfP1WwnkjzDX6pABZ/sCYwsL+TR17hPb0w6sNp6kwTEYe7/RU1 7I9OWcKi28nv5bDawo48nMjkQxfTMUAnMQ5w3TO0K9fujA51aUIUed+8nbrHI7BW5aci t4NRxoteHpYakKIKnr6JIZwDsnx+/xIXeWMX1hK9luKAXBj9wisaJAqkYLC78cVizUsL Jk5vu0SBY8d0wsPaj/qMWj9j6tcwHeVnqmhGuPiIdVrp2BEld30/afhQblQz9U148+b5 HE3wSHCp+RIyFag2J+MmtzSeVyprROTg04rwwY4DevMqWelEbM2uOs3QdLyMs1nsefHC ycAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=u6tUppeAw1GkvhZHHiMO4wqRTgk+sRVFx2srhoK9fj8=; b=BHlYT3HuGwX0QzWShmY0WPl8bP/xlw8EdHojP6WMSkh955EeDgVXGxpJokhpnWAROa 7FyE8uIvHfmCSPRL98Wi9Co7WefJ3d/EU+JVheO/f4DvsV+1tjkE1M9siTVULAsOc5P+ P+o2C1260a/xWwMyS37cZPI2QdNhMKbQFEgw+p7kvbvJdjmwe/8+rGzSOrUONayZM/Ii V7RKbFpPCoys11fzawNy6q0iazY+0SGYncBWnB3+0LbvklZ0eawFAOSYbycbi2IP5K8g He/NHjpAcKBhSSC1g6gnE3RhqQnD8XVmC6OiMXx2xIicYIpiNS1AGtAeq8mDs8iA4gdm chAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fO5didSK; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w23si10094542edq.372.2021.04.08.05.56.16; Thu, 08 Apr 2021 05:56:39 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fO5didSK; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231796AbhDHMwn (ORCPT + 99 others); Thu, 8 Apr 2021 08:52:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:58254 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231784AbhDHMw3 (ORCPT ); Thu, 8 Apr 2021 08:52:29 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E0E8F61154; Thu, 8 Apr 2021 12:52:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1617886338; bh=piulwOfs3Q/htdTQUT7rT3NxVXw4xuOw7TR5dbSr4uM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fO5didSKLOZkWUJaL3eC6sBtY+PHzj5yUFB4k/dl5QDmXUkmrvuAjmtYEJxXPDMAm heA/kOEKvZSkABzKjYYqjCs5UPQGD8aFpBxTwQCbbwETkI0evETnSAqmlHd6UogA1+ R9pzX2czuXIM9vvggraSLYEwhgNJWfcUD2jLsTcg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Jiri Slaby Subject: [PATCH 09/13] tty: move some internal tty lock enums and functions out of tty.h Date: Thu, 8 Apr 2021 14:51:30 +0200 Message-Id: <20210408125134.3016837-10-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210408125134.3016837-1-gregkh@linuxfoundation.org> References: <20210408125134.3016837-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Move the TTY_LOCK_* enums and tty_ldisc lock functions out of the global tty.h into the local header file to clean things up. Cc: Jiri Slaby Signed-off-by: Greg Kroah-Hartman --- drivers/tty/tty.h | 26 ++++++++++++++++++++++++++ drivers/tty/tty_buffer.c | 2 +- drivers/tty/tty_mutex.c | 1 + include/linux/tty.h | 26 -------------------------- 4 files changed, 28 insertions(+), 27 deletions(-) diff --git a/drivers/tty/tty.h b/drivers/tty/tty.h index a8a7abe5d635..ff904e947483 100644 --- a/drivers/tty/tty.h +++ b/drivers/tty/tty.h @@ -6,6 +6,32 @@ #ifndef _TTY_INTERNAL_H #define _TTY_INTERNAL_H +/* + * Lock subclasses for tty locks + * + * TTY_LOCK_NORMAL is for normal ttys and master ptys. + * TTY_LOCK_SLAVE is for slave ptys only. + * + * Lock subclasses are necessary for handling nested locking with pty pairs. + * tty locks which use nested locking: + * + * legacy_mutex - Nested tty locks are necessary for releasing pty pairs. + * The stable lock order is master pty first, then slave pty. + * termios_rwsem - The stable lock order is tty_buffer lock->termios_rwsem. + * Subclassing this lock enables the slave pty to hold its + * termios_rwsem when claiming the master tty_buffer lock. + * tty_buffer lock - slave ptys can claim nested buffer lock when handling + * signal chars. The stable lock order is slave pty, then + * master. + */ +enum { + TTY_LOCK_NORMAL = 0, + TTY_LOCK_SLAVE, +}; + +int tty_ldisc_lock(struct tty_struct *tty, unsigned long timeout); +void tty_ldisc_unlock(struct tty_struct *tty); + /* tty_audit.c */ #ifdef CONFIG_AUDIT void tty_audit_add_data(struct tty_struct *tty, const void *data, size_t size); diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c index 6d4995a5f318..9733469a14b2 100644 --- a/drivers/tty/tty_buffer.c +++ b/drivers/tty/tty_buffer.c @@ -17,7 +17,7 @@ #include #include #include - +#include "tty.h" #define MIN_TTYB_SIZE 256 #define TTYB_ALIGN_MASK 255 diff --git a/drivers/tty/tty_mutex.c b/drivers/tty/tty_mutex.c index 2640635ee177..393518a24cfe 100644 --- a/drivers/tty/tty_mutex.c +++ b/drivers/tty/tty_mutex.c @@ -4,6 +4,7 @@ #include #include #include +#include "tty.h" /* Legacy tty mutex glue */ diff --git a/include/linux/tty.h b/include/linux/tty.h index 981ee31c58e1..4b21d47bc098 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h @@ -16,30 +16,6 @@ #include -/* - * Lock subclasses for tty locks - * - * TTY_LOCK_NORMAL is for normal ttys and master ptys. - * TTY_LOCK_SLAVE is for slave ptys only. - * - * Lock subclasses are necessary for handling nested locking with pty pairs. - * tty locks which use nested locking: - * - * legacy_mutex - Nested tty locks are necessary for releasing pty pairs. - * The stable lock order is master pty first, then slave pty. - * termios_rwsem - The stable lock order is tty_buffer lock->termios_rwsem. - * Subclassing this lock enables the slave pty to hold its - * termios_rwsem when claiming the master tty_buffer lock. - * tty_buffer lock - slave ptys can claim nested buffer lock when handling - * signal chars. The stable lock order is slave pty, then - * master. - */ - -enum { - TTY_LOCK_NORMAL = 0, - TTY_LOCK_SLAVE, -}; - /* * (Note: the *_driver.minor_start values 1, 64, 128, 192 are * hardcoded at present.) @@ -419,8 +395,6 @@ extern struct tty_struct *tty_kopen_exclusive(dev_t device); extern struct tty_struct *tty_kopen_shared(dev_t device); extern void tty_kclose(struct tty_struct *tty); extern int tty_dev_name_to_number(const char *name, dev_t *number); -extern int tty_ldisc_lock(struct tty_struct *tty, unsigned long timeout); -extern void tty_ldisc_unlock(struct tty_struct *tty); extern ssize_t redirected_tty_write(struct kiocb *, struct iov_iter *); extern struct file *tty_release_redirect(struct tty_struct *tty); #else -- 2.31.1