Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1724625rdb; Wed, 31 Jan 2024 07:20:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IEHwKdD7pyBAyjulBgnEUSWeLor9UCThHhlmxx6C35ZKrii6AJf8xaaA/EQvliCbi9Vmu51 X-Received: by 2002:a05:6214:1c4d:b0:686:1e2:7480 with SMTP id if13-20020a0562141c4d00b0068601e27480mr2299923qvb.37.1706714427777; Wed, 31 Jan 2024 07:20:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706714427; cv=pass; d=google.com; s=arc-20160816; b=bWcPMH5ZZLiehCKcFP7R+xmruiUXgwmOu1JRrGW/OCdrucaiyKLcNM2nXGz0bwRj6G TBuAzwwwVdIclFxcBKkeX03nqJE/3xlYioUFgT0/a9UM3WiweJuDQ4Ppm+rR1O+SYHAH BxmIlVwx55GrQiZ/zw2kNcpHIGAq63mxJuo2my+5vYL9oQ885bYm/ooPD3QqdJykpCd9 RLB09oHC4+97lJ3j+WDT3MfpIjYtTWsVoC8K2laz/bgaLk3Eioc2NaYxyw24gccg0Tpq Zzx9USICIb+BTE7AwiUtcbkF5CiPJDa1PUjhmKPUWxvlRgt2900KL/YpPLj9l9oaxcWj yCIg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=NSTRvfGGQKyAJn5NLsi6ZwaeYKN+rxDYYT+uJi36lHE=; fh=Uwzs6rSKAkP9KIFcx1J+TnYckR7MVyF00g77j3XIN3E=; b=pki7mFIXbdXfkRveB5fN25x0RKL8QjIpg7q+WdrMxHx5NUTJ00t5DHaxrVjfP7oBPA ZTPUkffjW2VHq+o05BhHm5HpGcxjuwIlowleElwSB1PC9mlffHj4YhgKqAoWbgKmsVb+ KuTVyO4o90IURj4WGVvlHWhEZKaPZNNdhCgxv5ftxcdOrh5GgLSC4U+c9/8f/kbocYpJ TRu569KzCKTOqM69ez3jVGpOcT2LQMzP7Wmgdz6D75DEa3Sk5NcgO+a1ZWEBlmiImXaT F0WuJhEdkDaue4pypjmWtDkIsqDrfKrMPaDWite2ZOeyV48VV5aAMNW4C070qpJfJTNd 4v9w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=TCz5Ws7M; arc=pass (i=1 spf=pass spfdomain=ionos.com dkim=pass dkdomain=ionos.com dmarc=pass fromdomain=ionos.com); spf=pass (google.com: domain of linux-kernel+bounces-46653-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46653-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ionos.com X-Forwarded-Encrypted: i=1; AJvYcCXNFmIozMD/7b7ZSx1ffekw80hV3KZtj7r1VmsL0ihBBp76Ni3PPdzGnANpe57jW1SyLydg5vN+8BUoMnHuweYV0a9KEWNEwsDNsceHAQ== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id gy1-20020a056214242100b0068c475d53e0si7893982qvb.578.2024.01.31.07.20.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 07:20:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46653-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=TCz5Ws7M; arc=pass (i=1 spf=pass spfdomain=ionos.com dkim=pass dkdomain=ionos.com dmarc=pass fromdomain=ionos.com); spf=pass (google.com: domain of linux-kernel+bounces-46653-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46653-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ionos.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id D0E521C29D94 for ; Wed, 31 Jan 2024 14:55:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7087A131E5A; Wed, 31 Jan 2024 14:50:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b="TCz5Ws7M" Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BEE6712BF2A for ; Wed, 31 Jan 2024 14:50:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706712641; cv=none; b=G+CGJNliSqMo37SleAPrYZ8kPzXGtg3zJPl8sk6/EJJ9/uSihc3/dxKhItJ7oNZvf5aLAleA/VrlFo7cyChcf7KqP2OGj1E8Gha1N9QkzRCNdJ35DXq2nqNMzeibT29yxSFyVIdMx4FKiEk1ZgX2L1Mzcn5apPXD0T0pOZHuANI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706712641; c=relaxed/simple; bh=bSmfkQLi7Tof+lOuHt0NqZDdw8wFIAXp31kXa742YZY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=tUh9VUmWHrYMHxpjYTekhCGZXMbd3d+ngPZnxaELKoBqb4BfxCTsSHsKnG00Y/WyRYfBgc50cyN/lV3JI+YCSLx/hm6/G+XV5lXb0UyLVHQCKVEmeaar07EJoXYkuT0ziB8rszkKzET8gHp4IjH/dFVVYxVT7DH3KNoGbDC1ZLg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com; spf=pass smtp.mailfrom=ionos.com; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b=TCz5Ws7M; arc=none smtp.client-ip=209.85.221.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ionos.com Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-33ae3154cf8so2820897f8f.3 for ; Wed, 31 Jan 2024 06:50:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1706712630; x=1707317430; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NSTRvfGGQKyAJn5NLsi6ZwaeYKN+rxDYYT+uJi36lHE=; b=TCz5Ws7MwGZl5J3L52+6wq39FJ+hwms9uPkyjqzkl2YeJi3pyi47bDw9nb/bTyVpfq 87s5ED9QduoLuxlFIKQINmgCi4mPYGq4xvGOXxTc6ECri3R1kDc2OITGSjVBg0ZEZofj nEdQhiycfgPcUQPAEqIz6+FetiyLI/JUcS2sodJdC/4b2vNX85zHP8KsyslePHONVkBK 2hqVOPC6QPdnQ1LNclAQ2ocDTk8QCXgHGSflZDyj0+WTQNh0Jr8XXQijdHfTqYn9dbL8 //QRCWwy39v+ssU0Y1QZGeqK4/XB74fP4ZXNyvMIgQ4SV0iAJI8gZKpQd9g1KxCJc1v5 gjbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706712630; x=1707317430; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NSTRvfGGQKyAJn5NLsi6ZwaeYKN+rxDYYT+uJi36lHE=; b=qV9cKbka8TYYLd7bO2B2eV/P69tRZF6iSwL5kw4GR1zfDfV6lHB+eX6hsTuAuO/fAs mbxQV4IZtpWcey52d12/QQWojPbzI7gSkfjdauXfG53RzH/eqtc+Jrx+b/klBHeFFJ/W y+jI+yxUURs09f9ZMceExzvwtRA8seH56KmvbQGBoUzby9h9qGWOms4lKXngr3/DuXZU ihsjAtCKr13zIRmBznKSggo0jj1ahGUiiNUAoPE7Feo9BD7hEKkdQPasNa+D36+7z7mB +C+k0Uolqf3SCtOwaJ8sY1h8C4Zge5FlR2zs3XF2f32BEEsenlEay0Ub2VhHiNcxuGar azlQ== X-Gm-Message-State: AOJu0YzVW4PE9S0sbwfUzQD0lpZNa7biB2udd7wJo0zNoKTfQ31Splt+ ZZzy1ybaMtm88XBQf+17N0o7hhJCptwbHoof1C4BOt7LLQaTtHH+AdEBWCucE7EOlcoHxWOk0QZ g X-Received: by 2002:a05:6000:25b:b0:33a:f523:8267 with SMTP id m27-20020a056000025b00b0033af5238267mr1102637wrz.47.1706712629518; Wed, 31 Jan 2024 06:50:29 -0800 (PST) Received: from raven.blarg.de (p200300dc6f2f5c00023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f2f:5c00:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id ch15-20020a5d5d0f000000b0033905a60689sm13850173wrb.45.2024.01.31.06.50.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 06:50:29 -0800 (PST) From: Max Kellermann To: linux-kernel@vger.kernel.org Cc: Max Kellermann Subject: [PATCH 16/28] device.h: move declarations to device_types.h Date: Wed, 31 Jan 2024 15:49:56 +0100 Message-Id: <20240131145008.1345531-17-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240131145008.1345531-1-max.kellermann@ionos.com> References: <20240131145008.1345531-1-max.kellermann@ionos.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit By providing declarations in a lean header, we can reduce header dependencies. Signed-off-by: Max Kellermann --- block/disk-events.c | 1 + block/early-lookup.c | 1 + block/partitions/core.c | 1 + drivers/counter/counter-chrdev.c | 1 + drivers/cxl/cxl.h | 1 + drivers/devfreq/devfreq-event.c | 1 + drivers/extcon/extcon.h | 2 +- drivers/gpu/drm/mcde/mcde_clk_div.c | 1 + .../gpu/drm/renesas/rcar-du/rcar_du_encoder.c | 1 + .../drm/renesas/rcar-du/rcar_du_writeback.c | 2 + drivers/gpu/drm/sun4i/sun4i_layer.c | 2 + drivers/gpu/drm/sun4i/sun4i_tcon_dclk.c | 1 + drivers/gpu/drm/tidss/tidss_encoder.c | 1 + drivers/gpu/drm/tidss/tidss_plane.c | 1 + include/linux/acpi.h | 2 +- include/linux/backlight.h | 2 +- include/linux/blk_types.h | 2 +- include/linux/blkdev.h | 2 +- include/linux/container.h | 2 +- include/linux/coresight.h | 2 +- include/linux/counter.h | 2 +- include/linux/devfreq-event.h | 2 +- include/linux/devfreq.h | 2 +- include/linux/device.h | 466 +--------------- include/linux/device_types.h | 500 ++++++++++++++++++ include/linux/dmaengine.h | 2 +- include/linux/edac.h | 2 +- include/linux/enclosure.h | 2 +- include/linux/fpga/fpga-bridge.h | 2 +- include/linux/fpga/fpga-region.h | 2 +- include/linux/framer/framer.h | 2 +- include/linux/hdmi.h | 2 +- include/linux/hwmon-sysfs.h | 2 +- include/linux/iio/iio.h | 2 +- include/linux/lcd.h | 2 +- include/linux/node.h | 2 +- include/linux/pm_clock.h | 2 +- include/linux/pm_domain.h | 2 +- include/linux/pm_qos.h | 2 +- include/linux/power_supply.h | 2 +- include/linux/powercap.h | 2 +- include/linux/rtc.h | 2 +- include/linux/swiotlb.h | 3 +- include/linux/thermal.h | 2 +- include/linux/w1.h | 2 +- include/media/cec.h | 2 +- include/media/media-devnode.h | 2 +- include/net/nfc/nfc.h | 2 +- include/pcmcia/ss.h | 2 +- include/scsi/scsi_device.h | 1 + kernel/trace/blktrace.c | 1 + 51 files changed, 552 insertions(+), 500 deletions(-) create mode 100644 include/linux/device_types.h diff --git a/block/disk-events.c b/block/disk-events.c index e5b3006bcef6..3e182ba939b5 100644 --- a/block/disk-events.c +++ b/block/disk-events.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include "blk.h" diff --git a/block/early-lookup.c b/block/early-lookup.c index 3effbd0d35e9..44d0bc80afb5 100644 --- a/block/early-lookup.c +++ b/block/early-lookup.c @@ -5,6 +5,7 @@ */ #include #include +#include struct uuidcmp { const char *uuid; diff --git a/block/partitions/core.c b/block/partitions/core.c index e6aad6f5f97f..7adfa786b0b5 100644 --- a/block/partitions/core.c +++ b/block/partitions/core.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include "check.h" diff --git a/drivers/counter/counter-chrdev.c b/drivers/counter/counter-chrdev.c index afc94d0062b1..7d3e44315c8c 100644 --- a/drivers/counter/counter-chrdev.c +++ b/drivers/counter/counter-chrdev.c @@ -5,6 +5,7 @@ */ #include #include +#include #include #include #include diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h index 784bcd943215..0c4b2b3f6217 100644 --- a/drivers/cxl/cxl.h +++ b/drivers/cxl/cxl.h @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/devfreq/devfreq-event.c b/drivers/devfreq/devfreq-event.c index 3ebac2496679..9243135a701f 100644 --- a/drivers/devfreq/devfreq-event.c +++ b/drivers/devfreq/devfreq-event.c @@ -9,6 +9,7 @@ */ #include +#include #include #include #include diff --git a/drivers/extcon/extcon.h b/drivers/extcon/extcon.h index b2e0f715d81c..1b850b2a06ac 100644 --- a/drivers/extcon/extcon.h +++ b/drivers/extcon/extcon.h @@ -2,7 +2,7 @@ #ifndef __LINUX_EXTCON_INTERNAL_H__ #define __LINUX_EXTCON_INTERNAL_H__ -#include +#include #include /** diff --git a/drivers/gpu/drm/mcde/mcde_clk_div.c b/drivers/gpu/drm/mcde/mcde_clk_div.c index 3056ac566473..ac90497d366a 100644 --- a/drivers/gpu/drm/mcde/mcde_clk_div.c +++ b/drivers/gpu/drm/mcde/mcde_clk_div.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 #include +#include // for devm_kzalloc() #include #include diff --git a/drivers/gpu/drm/renesas/rcar-du/rcar_du_encoder.c b/drivers/gpu/drm/renesas/rcar-du/rcar_du_encoder.c index 7ecec7b04a8d..18842d466b74 100644 --- a/drivers/gpu/drm/renesas/rcar-du/rcar_du_encoder.c +++ b/drivers/gpu/drm/renesas/rcar-du/rcar_du_encoder.c @@ -7,6 +7,7 @@ * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) */ +#include // for dev_dbg() #include #include diff --git a/drivers/gpu/drm/renesas/rcar-du/rcar_du_writeback.c b/drivers/gpu/drm/renesas/rcar-du/rcar_du_writeback.c index 8cd37d7b8ae2..0fb49db3a5b6 100644 --- a/drivers/gpu/drm/renesas/rcar-du/rcar_du_writeback.c +++ b/drivers/gpu/drm/renesas/rcar-du/rcar_du_writeback.c @@ -13,6 +13,8 @@ #include #include +#include // for dev_dbg() + #include "rcar_du_crtc.h" #include "rcar_du_drv.h" #include "rcar_du_kms.h" diff --git a/drivers/gpu/drm/sun4i/sun4i_layer.c b/drivers/gpu/drm/sun4i/sun4i_layer.c index 98f3176366c0..77517fda1eda 100644 --- a/drivers/gpu/drm/sun4i/sun4i_layer.c +++ b/drivers/gpu/drm/sun4i/sun4i_layer.c @@ -11,6 +11,8 @@ #include #include +#include // for devm_kzalloc() + #include "sun4i_backend.h" #include "sun4i_frontend.h" #include "sun4i_layer.h" diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon_dclk.c b/drivers/gpu/drm/sun4i/sun4i_tcon_dclk.c index 03d7de1911cd..e27219f38e80 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tcon_dclk.c +++ b/drivers/gpu/drm/sun4i/sun4i_tcon_dclk.c @@ -7,6 +7,7 @@ */ #include +#include // for devm_kzalloc() #include #include "sun4i_tcon.h" diff --git a/drivers/gpu/drm/tidss/tidss_encoder.c b/drivers/gpu/drm/tidss/tidss_encoder.c index 17a86bed8054..c002c07f262e 100644 --- a/drivers/gpu/drm/tidss/tidss_encoder.c +++ b/drivers/gpu/drm/tidss/tidss_encoder.c @@ -4,6 +4,7 @@ * Author: Tomi Valkeinen */ +#include // for dev_dbg() #include #include diff --git a/drivers/gpu/drm/tidss/tidss_plane.c b/drivers/gpu/drm/tidss/tidss_plane.c index e1c0ef0c3894..41166047771b 100644 --- a/drivers/gpu/drm/tidss/tidss_plane.c +++ b/drivers/gpu/drm/tidss/tidss_plane.c @@ -11,6 +11,7 @@ #include #include #include +#include // for dev_dbg() #include "tidss_crtc.h" #include "tidss_dispc.h" diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 3beab76d31d4..9f0a021dfef3 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -11,7 +11,7 @@ #include #include /* for struct resource */ #include -#include +#include #include #include #include diff --git a/include/linux/backlight.h b/include/linux/backlight.h index 614653e07e3a..9164ee5f1c8b 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h @@ -9,7 +9,7 @@ #ifndef _LINUX_BACKLIGHT_H #define _LINUX_BACKLIGHT_H -#include +#include #include #include #include diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index 9d2d8a8328a6..96a37f399928 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h @@ -8,7 +8,7 @@ #include #include -#include +#include #include struct bio_set; diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 3a14de75286a..3916d2f0a9af 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -8,7 +8,7 @@ #include #include // for inode_unhashed() #include -#include +#include #include #include #include diff --git a/include/linux/container.h b/include/linux/container.h index dd00cc918a92..a90e59f0c65d 100644 --- a/include/linux/container.h +++ b/include/linux/container.h @@ -9,7 +9,7 @@ #ifndef _LINUX_CONTAINER_H #define _LINUX_CONTAINER_H -#include +#include /* drivers/base/power/container.c */ extern const struct bus_type container_subsys; diff --git a/include/linux/coresight.h b/include/linux/coresight.h index a4cb7dd6ca23..fce16528de85 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include #include diff --git a/include/linux/counter.h b/include/linux/counter.h index 638ebb5b4d27..95e8067f4b78 100644 --- a/include/linux/counter.h +++ b/include/linux/counter.h @@ -7,7 +7,7 @@ #define _COUNTER_H_ #include -#include +#include #include #include #include diff --git a/include/linux/devfreq-event.h b/include/linux/devfreq-event.h index 4a50a5c71a5f..36f0e6cf7cc5 100644 --- a/include/linux/devfreq-event.h +++ b/include/linux/devfreq-event.h @@ -9,7 +9,7 @@ #ifndef __LINUX_DEVFREQ_EVENT_H__ #define __LINUX_DEVFREQ_EVENT_H__ -#include +#include /** * struct devfreq_event_dev - the devfreq-event device diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h index d312ffbac4dd..bf8d30af9fa2 100644 --- a/include/linux/devfreq.h +++ b/include/linux/devfreq.h @@ -10,7 +10,7 @@ #ifndef __LINUX_DEVFREQ_H__ #define __LINUX_DEVFREQ_H__ -#include +#include #include #include #include diff --git a/include/linux/device.h b/include/linux/device.h index 3e221c132d89..56735ece2ada 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -12,6 +12,7 @@ #ifndef _DEVICE_H_ #define _DEVICE_H_ +#include #include #include #include @@ -30,7 +31,6 @@ #include #include #include // for __ATTR_* -#include struct device; struct device_private; @@ -46,27 +46,6 @@ struct dev_pin_info; struct dev_iommu; struct msi_device_data; -/** - * struct subsys_interface - interfaces to device functions - * @name: name of the device function - * @subsys: subsystem of the devices to attach to - * @node: the list of functions registered at the subsystem - * @add_dev: device hookup to device function handler - * @remove_dev: device hookup to device function handler - * - * Simple interfaces attached to a subsystem. Multiple interfaces can - * attach to a subsystem and its devices. Unlike drivers, they do not - * exclusively claim or control devices. Interfaces usually represent - * a specific functionality of a subsystem/class of devices. - */ -struct subsys_interface { - const char *name; - const struct bus_type *subsys; - struct list_head node; - int (*add_dev)(struct device *dev, struct subsys_interface *sif); - void (*remove_dev)(struct device *dev, struct subsys_interface *sif); -}; - int subsys_interface_register(struct subsys_interface *sif); void subsys_interface_unregister(struct subsys_interface *sif); @@ -75,50 +54,6 @@ int subsys_system_register(const struct bus_type *subsys, int subsys_virtual_register(const struct bus_type *subsys, const struct attribute_group **groups); -/* - * The type of device, "struct device" is embedded in. A class - * or bus can contain devices of different types - * like "partitions" and "disks", "mouse" and "event". - * This identifies the device type and carries type-specific - * information, equivalent to the kobj_type of a kobject. - * If "name" is specified, the uevent will contain it in - * the DEVTYPE variable. - */ -struct device_type { - const char *name; - const struct attribute_group **groups; - int (*uevent)(const struct device *dev, struct kobj_uevent_env *env); - char *(*devnode)(const struct device *dev, umode_t *mode, - kuid_t *uid, kgid_t *gid); - void (*release)(struct device *dev); - - const struct dev_pm_ops *pm; -}; - -/** - * struct device_attribute - Interface for exporting device attributes. - * @attr: sysfs attribute definition. - * @show: Show handler. - * @store: Store handler. - */ -struct device_attribute { - struct attribute attr; - ssize_t (*show)(struct device *dev, struct device_attribute *attr, - char *buf); - ssize_t (*store)(struct device *dev, struct device_attribute *attr, - const char *buf, size_t count); -}; - -/** - * struct dev_ext_attribute - Exported device attribute with extra context. - * @attr: Exported device attribute. - * @var: Pointer to context. - */ -struct dev_ext_attribute { - struct device_attribute attr; - void *var; -}; - ssize_t device_show_ulong(struct device *dev, struct device_attribute *attr, char *buf); ssize_t device_store_ulong(struct device *dev, struct device_attribute *attr, @@ -423,34 +358,6 @@ void __percpu *__devm_alloc_percpu(struct device *dev, size_t size, size_t align); void devm_free_percpu(struct device *dev, void __percpu *pdata); -struct device_dma_parameters { - /* - * a low level driver may set these to teach IOMMU code about - * sg limitations. - */ - unsigned int max_segment_size; - unsigned int min_align_mask; - unsigned long segment_boundary_mask; -}; - -/** - * enum device_link_state - Device link states. - * @DL_STATE_NONE: The presence of the drivers is not being tracked. - * @DL_STATE_DORMANT: None of the supplier/consumer drivers is present. - * @DL_STATE_AVAILABLE: The supplier driver is present, but the consumer is not. - * @DL_STATE_CONSUMER_PROBE: The consumer is probing (supplier driver present). - * @DL_STATE_ACTIVE: Both the supplier and consumer drivers are present. - * @DL_STATE_SUPPLIER_UNBIND: The supplier driver is unbinding. - */ -enum device_link_state { - DL_STATE_NONE = -1, - DL_STATE_DORMANT = 0, - DL_STATE_AVAILABLE, - DL_STATE_CONSUMER_PROBE, - DL_STATE_ACTIVE, - DL_STATE_SUPPLIER_UNBIND, -}; - /* * Device link flags. * @@ -475,363 +382,6 @@ enum device_link_state { #define DL_FLAG_INFERRED BIT(8) #define DL_FLAG_CYCLE BIT(9) -/** - * enum dl_dev_state - Device driver presence tracking information. - * @DL_DEV_NO_DRIVER: There is no driver attached to the device. - * @DL_DEV_PROBING: A driver is probing. - * @DL_DEV_DRIVER_BOUND: The driver has been bound to the device. - * @DL_DEV_UNBINDING: The driver is unbinding from the device. - */ -enum dl_dev_state { - DL_DEV_NO_DRIVER = 0, - DL_DEV_PROBING, - DL_DEV_DRIVER_BOUND, - DL_DEV_UNBINDING, -}; - -/** - * enum device_removable - Whether the device is removable. The criteria for a - * device to be classified as removable is determined by its subsystem or bus. - * @DEVICE_REMOVABLE_NOT_SUPPORTED: This attribute is not supported for this - * device (default). - * @DEVICE_REMOVABLE_UNKNOWN: Device location is Unknown. - * @DEVICE_FIXED: Device is not removable by the user. - * @DEVICE_REMOVABLE: Device is removable by the user. - */ -enum device_removable { - DEVICE_REMOVABLE_NOT_SUPPORTED = 0, /* must be 0 */ - DEVICE_REMOVABLE_UNKNOWN, - DEVICE_FIXED, - DEVICE_REMOVABLE, -}; - -/** - * struct dev_links_info - Device data related to device links. - * @suppliers: List of links to supplier devices. - * @consumers: List of links to consumer devices. - * @defer_sync: Hook to global list of devices that have deferred sync_state. - * @status: Driver status information. - */ -struct dev_links_info { - struct list_head suppliers; - struct list_head consumers; - struct list_head defer_sync; - enum dl_dev_state status; -}; - -/** - * struct dev_msi_info - Device data related to MSI - * @domain: The MSI interrupt domain associated to the device - * @data: Pointer to MSI device data - */ -struct dev_msi_info { -#ifdef CONFIG_GENERIC_MSI_IRQ - struct irq_domain *domain; - struct msi_device_data *data; -#endif -}; - -/** - * enum device_physical_location_panel - Describes which panel surface of the - * system's housing the device connection point resides on. - * @DEVICE_PANEL_TOP: Device connection point is on the top panel. - * @DEVICE_PANEL_BOTTOM: Device connection point is on the bottom panel. - * @DEVICE_PANEL_LEFT: Device connection point is on the left panel. - * @DEVICE_PANEL_RIGHT: Device connection point is on the right panel. - * @DEVICE_PANEL_FRONT: Device connection point is on the front panel. - * @DEVICE_PANEL_BACK: Device connection point is on the back panel. - * @DEVICE_PANEL_UNKNOWN: The panel with device connection point is unknown. - */ -enum device_physical_location_panel { - DEVICE_PANEL_TOP, - DEVICE_PANEL_BOTTOM, - DEVICE_PANEL_LEFT, - DEVICE_PANEL_RIGHT, - DEVICE_PANEL_FRONT, - DEVICE_PANEL_BACK, - DEVICE_PANEL_UNKNOWN, -}; - -/** - * enum device_physical_location_vertical_position - Describes vertical - * position of the device connection point on the panel surface. - * @DEVICE_VERT_POS_UPPER: Device connection point is at upper part of panel. - * @DEVICE_VERT_POS_CENTER: Device connection point is at center part of panel. - * @DEVICE_VERT_POS_LOWER: Device connection point is at lower part of panel. - */ -enum device_physical_location_vertical_position { - DEVICE_VERT_POS_UPPER, - DEVICE_VERT_POS_CENTER, - DEVICE_VERT_POS_LOWER, -}; - -/** - * enum device_physical_location_horizontal_position - Describes horizontal - * position of the device connection point on the panel surface. - * @DEVICE_HORI_POS_LEFT: Device connection point is at left part of panel. - * @DEVICE_HORI_POS_CENTER: Device connection point is at center part of panel. - * @DEVICE_HORI_POS_RIGHT: Device connection point is at right part of panel. - */ -enum device_physical_location_horizontal_position { - DEVICE_HORI_POS_LEFT, - DEVICE_HORI_POS_CENTER, - DEVICE_HORI_POS_RIGHT, -}; - -/** - * struct device_physical_location - Device data related to physical location - * of the device connection point. - * @panel: Panel surface of the system's housing that the device connection - * point resides on. - * @vertical_position: Vertical position of the device connection point within - * the panel. - * @horizontal_position: Horizontal position of the device connection point - * within the panel. - * @dock: Set if the device connection point resides in a docking station or - * port replicator. - * @lid: Set if this device connection point resides on the lid of laptop - * system. - */ -struct device_physical_location { - enum device_physical_location_panel panel; - enum device_physical_location_vertical_position vertical_position; - enum device_physical_location_horizontal_position horizontal_position; - bool dock; - bool lid; -}; - -/** - * struct device - The basic device structure - * @parent: The device's "parent" device, the device to which it is attached. - * In most cases, a parent device is some sort of bus or host - * controller. If parent is NULL, the device, is a top-level device, - * which is not usually what you want. - * @p: Holds the private data of the driver core portions of the device. - * See the comment of the struct device_private for detail. - * @kobj: A top-level, abstract class from which other classes are derived. - * @init_name: Initial name of the device. - * @type: The type of device. - * This identifies the device type and carries type-specific - * information. - * @mutex: Mutex to synchronize calls to its driver. - * @bus: Type of bus device is on. - * @driver: Which driver has allocated this - * @platform_data: Platform data specific to the device. - * Example: For devices on custom boards, as typical of embedded - * and SOC based hardware, Linux often uses platform_data to point - * to board-specific structures describing devices and how they - * are wired. That can include what ports are available, chip - * variants, which GPIO pins act in what additional roles, and so - * on. This shrinks the "Board Support Packages" (BSPs) and - * minimizes board-specific #ifdefs in drivers. - * @driver_data: Private pointer for driver specific info. - * @links: Links to suppliers and consumers of this device. - * @power: For device power management. - * See Documentation/driver-api/pm/devices.rst for details. - * @pm_domain: Provide callbacks that are executed during system suspend, - * hibernation, system resume and during runtime PM transitions - * along with subsystem-level and driver-level callbacks. - * @em_pd: device's energy model performance domain - * @pins: For device pin management. - * See Documentation/driver-api/pin-control.rst for details. - * @msi: MSI related data - * @numa_node: NUMA node this device is close to. - * @dma_ops: DMA mapping operations for this device. - * @dma_mask: Dma mask (if dma'ble device). - * @coherent_dma_mask: Like dma_mask, but for alloc_coherent mapping as not all - * hardware supports 64-bit addresses for consistent allocations - * such descriptors. - * @bus_dma_limit: Limit of an upstream bridge or bus which imposes a smaller - * DMA limit than the device itself supports. - * @dma_range_map: map for DMA memory ranges relative to that of RAM - * @dma_parms: A low level driver may set these to teach IOMMU code about - * segment limitations. - * @dma_pools: Dma pools (if dma'ble device). - * @dma_mem: Internal for coherent mem override. - * @cma_area: Contiguous memory area for dma allocations - * @dma_io_tlb_mem: Software IO TLB allocator. Not for driver use. - * @dma_io_tlb_pools: List of transient swiotlb memory pools. - * @dma_io_tlb_lock: Protects changes to the list of active pools. - * @dma_uses_io_tlb: %true if device has used the software IO TLB. - * @archdata: For arch-specific additions. - * @of_node: Associated device tree node. - * @fwnode: Associated device node supplied by platform firmware. - * @devt: For creating the sysfs "dev". - * @id: device instance - * @devres_lock: Spinlock to protect the resource of the device. - * @devres_head: The resources list of the device. - * @class: The class of the device. - * @groups: Optional attribute groups. - * @release: Callback to free the device after all references have - * gone away. This should be set by the allocator of the - * device (i.e. the bus driver that discovered the device). - * @iommu_group: IOMMU group the device belongs to. - * @iommu: Per device generic IOMMU runtime data - * @physical_location: Describes physical location of the device connection - * point in the system housing. - * @removable: Whether the device can be removed from the system. This - * should be set by the subsystem / bus driver that discovered - * the device. - * - * @offline_disabled: If set, the device is permanently online. - * @offline: Set after successful invocation of bus type's .offline(). - * @of_node_reused: Set if the device-tree node is shared with an ancestor - * device. - * @state_synced: The hardware state of this device has been synced to match - * the software state of this device by calling the driver/bus - * sync_state() callback. - * @can_match: The device has matched with a driver at least once or it is in - * a bus (like AMBA) which can't check for matching drivers until - * other devices probe successfully. - * @dma_coherent: this particular device is dma coherent, even if the - * architecture supports non-coherent devices. - * @dma_ops_bypass: If set to %true then the dma_ops are bypassed for the - * streaming DMA operations (->map_* / ->unmap_* / ->sync_*), - * and optionall (if the coherent mask is large enough) also - * for dma allocations. This flag is managed by the dma ops - * instance from ->dma_supported. - * - * At the lowest level, every device in a Linux system is represented by an - * instance of struct device. The device structure contains the information - * that the device model core needs to model the system. Most subsystems, - * however, track additional information about the devices they host. As a - * result, it is rare for devices to be represented by bare device structures; - * instead, that structure, like kobject structures, is usually embedded within - * a higher-level representation of the device. - */ -struct device { - struct kobject kobj; - struct device *parent; - - struct device_private *p; - - const char *init_name; /* initial name of the device */ - const struct device_type *type; - - const struct bus_type *bus; /* type of bus device is on */ - struct device_driver *driver; /* which driver has allocated this - device */ - void *platform_data; /* Platform specific data, device - core doesn't touch it */ - void *driver_data; /* Driver data, set and get with - dev_set_drvdata/dev_get_drvdata */ - struct mutex mutex; /* mutex to synchronize calls to - * its driver. - */ - - struct dev_links_info links; - struct dev_pm_info power; - struct dev_pm_domain *pm_domain; - -#ifdef CONFIG_ENERGY_MODEL - struct em_perf_domain *em_pd; -#endif - -#ifdef CONFIG_PINCTRL - struct dev_pin_info *pins; -#endif - struct dev_msi_info msi; -#ifdef CONFIG_DMA_OPS - const struct dma_map_ops *dma_ops; -#endif - u64 *dma_mask; /* dma mask (if dma'able device) */ - u64 coherent_dma_mask;/* Like dma_mask, but for - alloc_coherent mappings as - not all hardware supports - 64 bit addresses for consistent - allocations such descriptors. */ - u64 bus_dma_limit; /* upstream dma constraint */ - const struct bus_dma_region *dma_range_map; - - struct device_dma_parameters *dma_parms; - - struct list_head dma_pools; /* dma pools (if dma'ble) */ - -#ifdef CONFIG_DMA_DECLARE_COHERENT - struct dma_coherent_mem *dma_mem; /* internal for coherent mem - override */ -#endif -#ifdef CONFIG_DMA_CMA - struct cma *cma_area; /* contiguous memory area for dma - allocations */ -#endif -#ifdef CONFIG_SWIOTLB - struct io_tlb_mem *dma_io_tlb_mem; -#endif -#ifdef CONFIG_SWIOTLB_DYNAMIC - struct list_head dma_io_tlb_pools; - spinlock_t dma_io_tlb_lock; - bool dma_uses_io_tlb; -#endif - /* arch specific additions */ - struct dev_archdata archdata; - - struct device_node *of_node; /* associated device tree node */ - struct fwnode_handle *fwnode; /* firmware device node */ - -#ifdef CONFIG_NUMA - int numa_node; /* NUMA node this device is close to */ -#endif - dev_t devt; /* dev_t, creates the sysfs "dev" */ - u32 id; /* device instance */ - - spinlock_t devres_lock; - struct list_head devres_head; - - const struct class *class; - const struct attribute_group **groups; /* optional groups */ - - void (*release)(struct device *dev); - struct iommu_group *iommu_group; - struct dev_iommu *iommu; - - struct device_physical_location *physical_location; - - enum device_removable removable; - - bool offline_disabled:1; - bool offline:1; - bool of_node_reused:1; - bool state_synced:1; - bool can_match:1; -#if defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE) || \ - defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU) || \ - defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU_ALL) - bool dma_coherent:1; -#endif -#ifdef CONFIG_DMA_OPS_BYPASS - bool dma_ops_bypass : 1; -#endif -}; - -/** - * struct device_link - Device link representation. - * @supplier: The device on the supplier end of the link. - * @s_node: Hook to the supplier device's list of links to consumers. - * @consumer: The device on the consumer end of the link. - * @c_node: Hook to the consumer device's list of links to suppliers. - * @link_dev: device used to expose link details in sysfs - * @status: The state of the link (with respect to the presence of drivers). - * @flags: Link flags. - * @rpm_active: Whether or not the consumer device is runtime-PM-active. - * @kref: Count repeated addition of the same link. - * @rm_work: Work structure used for removing the link. - * @supplier_preactivated: Supplier has been made active before consumer probe. - */ -struct device_link { - struct device *supplier; - struct list_head s_node; - struct device *consumer; - struct list_head c_node; - struct device link_dev; - enum device_link_state status; - u32 flags; - refcount_t rpm_active; - struct kref kref; - struct work_struct rm_work; - bool supplier_preactivated; /* Owned by consumer probe. */ -}; - #define kobj_to_dev(__kobj) container_of_const(__kobj, struct device, kobj) /** @@ -847,20 +397,6 @@ static inline bool device_iommu_mapped(struct device *dev) /* Get the wakeup routines, which depend on struct device */ #include -/** - * dev_name - Return a device's name. - * @dev: Device with name to get. - * Return: The kobject name of the device, or its initial name if unavailable. - */ -static inline const char *dev_name(const struct device *dev) -{ - /* Use the init name until the kobject becomes available */ - if (dev->init_name) - return dev->init_name; - - return kobject_name(&dev->kobj); -} - /** * dev_bus_name - Return a device's bus/class name, if at all possible * @dev: struct device to get the bus/class name of diff --git a/include/linux/device_types.h b/include/linux/device_types.h new file mode 100644 index 000000000000..1e5a3842d5d3 --- /dev/null +++ b/include/linux/device_types.h @@ -0,0 +1,500 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * device.h - generic, centralized driver model + * + * Copyright (c) 2001-2003 Patrick Mochel + * Copyright (c) 2004-2009 Greg Kroah-Hartman + * Copyright (c) 2008-2009 Novell Inc. + * + * See Documentation/driver-api/driver-model/ for more information. + */ + +#ifndef _DEVICE_TYPES_H_ +#define _DEVICE_TYPES_H_ + +#include +#include +#include +#include +#include + +struct device; +struct device_private; +struct device_driver; +struct driver_private; +struct module; +struct class; +struct subsys_private; +struct device_node; +struct fwnode_handle; +struct iommu_group; +struct dev_pin_info; +struct dev_iommu; +struct msi_device_data; +struct kobj_uevent_env; + +/** + * struct subsys_interface - interfaces to device functions + * @name: name of the device function + * @subsys: subsystem of the devices to attach to + * @node: the list of functions registered at the subsystem + * @add_dev: device hookup to device function handler + * @remove_dev: device hookup to device function handler + * + * Simple interfaces attached to a subsystem. Multiple interfaces can + * attach to a subsystem and its devices. Unlike drivers, they do not + * exclusively claim or control devices. Interfaces usually represent + * a specific functionality of a subsystem/class of devices. + */ +struct subsys_interface { + const char *name; + const struct bus_type *subsys; + struct list_head node; + int (*add_dev)(struct device *dev, struct subsys_interface *sif); + void (*remove_dev)(struct device *dev, struct subsys_interface *sif); +}; + +/* + * The type of device, "struct device" is embedded in. A class + * or bus can contain devices of different types + * like "partitions" and "disks", "mouse" and "event". + * This identifies the device type and carries type-specific + * information, equivalent to the kobj_type of a kobject. + * If "name" is specified, the uevent will contain it in + * the DEVTYPE variable. + */ +struct device_type { + const char *name; + const struct attribute_group **groups; + int (*uevent)(const struct device *dev, struct kobj_uevent_env *env); + char *(*devnode)(const struct device *dev, umode_t *mode, + kuid_t *uid, kgid_t *gid); + void (*release)(struct device *dev); + + const struct dev_pm_ops *pm; +}; + +/** + * struct device_attribute - Interface for exporting device attributes. + * @attr: sysfs attribute definition. + * @show: Show handler. + * @store: Store handler. + */ +struct device_attribute { + struct attribute attr; + ssize_t (*show)(struct device *dev, struct device_attribute *attr, + char *buf); + ssize_t (*store)(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count); +}; + +/** + * struct dev_ext_attribute - Exported device attribute with extra context. + * @attr: Exported device attribute. + * @var: Pointer to context. + */ +struct dev_ext_attribute { + struct device_attribute attr; + void *var; +}; + +struct device_dma_parameters { + /* + * a low level driver may set these to teach IOMMU code about + * sg limitations. + */ + unsigned int max_segment_size; + unsigned int min_align_mask; + unsigned long segment_boundary_mask; +}; + +/** + * enum device_link_state - Device link states. + * @DL_STATE_NONE: The presence of the drivers is not being tracked. + * @DL_STATE_DORMANT: None of the supplier/consumer drivers is present. + * @DL_STATE_AVAILABLE: The supplier driver is present, but the consumer is not. + * @DL_STATE_CONSUMER_PROBE: The consumer is probing (supplier driver present). + * @DL_STATE_ACTIVE: Both the supplier and consumer drivers are present. + * @DL_STATE_SUPPLIER_UNBIND: The supplier driver is unbinding. + */ +enum device_link_state { + DL_STATE_NONE = -1, + DL_STATE_DORMANT = 0, + DL_STATE_AVAILABLE, + DL_STATE_CONSUMER_PROBE, + DL_STATE_ACTIVE, + DL_STATE_SUPPLIER_UNBIND, +}; + +/** + * enum dl_dev_state - Device driver presence tracking information. + * @DL_DEV_NO_DRIVER: There is no driver attached to the device. + * @DL_DEV_PROBING: A driver is probing. + * @DL_DEV_DRIVER_BOUND: The driver has been bound to the device. + * @DL_DEV_UNBINDING: The driver is unbinding from the device. + */ +enum dl_dev_state { + DL_DEV_NO_DRIVER = 0, + DL_DEV_PROBING, + DL_DEV_DRIVER_BOUND, + DL_DEV_UNBINDING, +}; + +/** + * enum device_removable - Whether the device is removable. The criteria for a + * device to be classified as removable is determined by its subsystem or bus. + * @DEVICE_REMOVABLE_NOT_SUPPORTED: This attribute is not supported for this + * device (default). + * @DEVICE_REMOVABLE_UNKNOWN: Device location is Unknown. + * @DEVICE_FIXED: Device is not removable by the user. + * @DEVICE_REMOVABLE: Device is removable by the user. + */ +enum device_removable { + DEVICE_REMOVABLE_NOT_SUPPORTED = 0, /* must be 0 */ + DEVICE_REMOVABLE_UNKNOWN, + DEVICE_FIXED, + DEVICE_REMOVABLE, +}; + +/** + * struct dev_links_info - Device data related to device links. + * @suppliers: List of links to supplier devices. + * @consumers: List of links to consumer devices. + * @defer_sync: Hook to global list of devices that have deferred sync_state. + * @status: Driver status information. + */ +struct dev_links_info { + struct list_head suppliers; + struct list_head consumers; + struct list_head defer_sync; + enum dl_dev_state status; +}; + +/** + * struct dev_msi_info - Device data related to MSI + * @domain: The MSI interrupt domain associated to the device + * @data: Pointer to MSI device data + */ +struct dev_msi_info { +#ifdef CONFIG_GENERIC_MSI_IRQ + struct irq_domain *domain; + struct msi_device_data *data; +#endif +}; + +/** + * enum device_physical_location_panel - Describes which panel surface of the + * system's housing the device connection point resides on. + * @DEVICE_PANEL_TOP: Device connection point is on the top panel. + * @DEVICE_PANEL_BOTTOM: Device connection point is on the bottom panel. + * @DEVICE_PANEL_LEFT: Device connection point is on the left panel. + * @DEVICE_PANEL_RIGHT: Device connection point is on the right panel. + * @DEVICE_PANEL_FRONT: Device connection point is on the front panel. + * @DEVICE_PANEL_BACK: Device connection point is on the back panel. + * @DEVICE_PANEL_UNKNOWN: The panel with device connection point is unknown. + */ +enum device_physical_location_panel { + DEVICE_PANEL_TOP, + DEVICE_PANEL_BOTTOM, + DEVICE_PANEL_LEFT, + DEVICE_PANEL_RIGHT, + DEVICE_PANEL_FRONT, + DEVICE_PANEL_BACK, + DEVICE_PANEL_UNKNOWN, +}; + +/** + * enum device_physical_location_vertical_position - Describes vertical + * position of the device connection point on the panel surface. + * @DEVICE_VERT_POS_UPPER: Device connection point is at upper part of panel. + * @DEVICE_VERT_POS_CENTER: Device connection point is at center part of panel. + * @DEVICE_VERT_POS_LOWER: Device connection point is at lower part of panel. + */ +enum device_physical_location_vertical_position { + DEVICE_VERT_POS_UPPER, + DEVICE_VERT_POS_CENTER, + DEVICE_VERT_POS_LOWER, +}; + +/** + * enum device_physical_location_horizontal_position - Describes horizontal + * position of the device connection point on the panel surface. + * @DEVICE_HORI_POS_LEFT: Device connection point is at left part of panel. + * @DEVICE_HORI_POS_CENTER: Device connection point is at center part of panel. + * @DEVICE_HORI_POS_RIGHT: Device connection point is at right part of panel. + */ +enum device_physical_location_horizontal_position { + DEVICE_HORI_POS_LEFT, + DEVICE_HORI_POS_CENTER, + DEVICE_HORI_POS_RIGHT, +}; + +/** + * struct device_physical_location - Device data related to physical location + * of the device connection point. + * @panel: Panel surface of the system's housing that the device connection + * point resides on. + * @vertical_position: Vertical position of the device connection point within + * the panel. + * @horizontal_position: Horizontal position of the device connection point + * within the panel. + * @dock: Set if the device connection point resides in a docking station or + * port replicator. + * @lid: Set if this device connection point resides on the lid of laptop + * system. + */ +struct device_physical_location { + enum device_physical_location_panel panel; + enum device_physical_location_vertical_position vertical_position; + enum device_physical_location_horizontal_position horizontal_position; + bool dock; + bool lid; +}; + +/** + * struct device - The basic device structure + * @parent: The device's "parent" device, the device to which it is attached. + * In most cases, a parent device is some sort of bus or host + * controller. If parent is NULL, the device, is a top-level device, + * which is not usually what you want. + * @p: Holds the private data of the driver core portions of the device. + * See the comment of the struct device_private for detail. + * @kobj: A top-level, abstract class from which other classes are derived. + * @init_name: Initial name of the device. + * @type: The type of device. + * This identifies the device type and carries type-specific + * information. + * @mutex: Mutex to synchronize calls to its driver. + * @bus: Type of bus device is on. + * @driver: Which driver has allocated this + * @platform_data: Platform data specific to the device. + * Example: For devices on custom boards, as typical of embedded + * and SOC based hardware, Linux often uses platform_data to point + * to board-specific structures describing devices and how they + * are wired. That can include what ports are available, chip + * variants, which GPIO pins act in what additional roles, and so + * on. This shrinks the "Board Support Packages" (BSPs) and + * minimizes board-specific #ifdefs in drivers. + * @driver_data: Private pointer for driver specific info. + * @links: Links to suppliers and consumers of this device. + * @power: For device power management. + * See Documentation/driver-api/pm/devices.rst for details. + * @pm_domain: Provide callbacks that are executed during system suspend, + * hibernation, system resume and during runtime PM transitions + * along with subsystem-level and driver-level callbacks. + * @em_pd: device's energy model performance domain + * @pins: For device pin management. + * See Documentation/driver-api/pin-control.rst for details. + * @msi: MSI related data + * @numa_node: NUMA node this device is close to. + * @dma_ops: DMA mapping operations for this device. + * @dma_mask: Dma mask (if dma'ble device). + * @coherent_dma_mask: Like dma_mask, but for alloc_coherent mapping as not all + * hardware supports 64-bit addresses for consistent allocations + * such descriptors. + * @bus_dma_limit: Limit of an upstream bridge or bus which imposes a smaller + * DMA limit than the device itself supports. + * @dma_range_map: map for DMA memory ranges relative to that of RAM + * @dma_parms: A low level driver may set these to teach IOMMU code about + * segment limitations. + * @dma_pools: Dma pools (if dma'ble device). + * @dma_mem: Internal for coherent mem override. + * @cma_area: Contiguous memory area for dma allocations + * @dma_io_tlb_mem: Software IO TLB allocator. Not for driver use. + * @dma_io_tlb_pools: List of transient swiotlb memory pools. + * @dma_io_tlb_lock: Protects changes to the list of active pools. + * @dma_uses_io_tlb: %true if device has used the software IO TLB. + * @archdata: For arch-specific additions. + * @of_node: Associated device tree node. + * @fwnode: Associated device node supplied by platform firmware. + * @devt: For creating the sysfs "dev". + * @id: device instance + * @devres_lock: Spinlock to protect the resource of the device. + * @devres_head: The resources list of the device. + * @class: The class of the device. + * @groups: Optional attribute groups. + * @release: Callback to free the device after all references have + * gone away. This should be set by the allocator of the + * device (i.e. the bus driver that discovered the device). + * @iommu_group: IOMMU group the device belongs to. + * @iommu: Per device generic IOMMU runtime data + * @physical_location: Describes physical location of the device connection + * point in the system housing. + * @removable: Whether the device can be removed from the system. This + * should be set by the subsystem / bus driver that discovered + * the device. + * + * @offline_disabled: If set, the device is permanently online. + * @offline: Set after successful invocation of bus type's .offline(). + * @of_node_reused: Set if the device-tree node is shared with an ancestor + * device. + * @state_synced: The hardware state of this device has been synced to match + * the software state of this device by calling the driver/bus + * sync_state() callback. + * @can_match: The device has matched with a driver at least once or it is in + * a bus (like AMBA) which can't check for matching drivers until + * other devices probe successfully. + * @dma_coherent: this particular device is dma coherent, even if the + * architecture supports non-coherent devices. + * @dma_ops_bypass: If set to %true then the dma_ops are bypassed for the + * streaming DMA operations (->map_* / ->unmap_* / ->sync_*), + * and optionall (if the coherent mask is large enough) also + * for dma allocations. This flag is managed by the dma ops + * instance from ->dma_supported. + * + * At the lowest level, every device in a Linux system is represented by an + * instance of struct device. The device structure contains the information + * that the device model core needs to model the system. Most subsystems, + * however, track additional information about the devices they host. As a + * result, it is rare for devices to be represented by bare device structures; + * instead, that structure, like kobject structures, is usually embedded within + * a higher-level representation of the device. + */ +struct device { + struct kobject kobj; + struct device *parent; + + struct device_private *p; + + const char *init_name; /* initial name of the device */ + const struct device_type *type; + + const struct bus_type *bus; /* type of bus device is on */ + struct device_driver *driver; /* which driver has allocated this + device */ + void *platform_data; /* Platform specific data, device + core doesn't touch it */ + void *driver_data; /* Driver data, set and get with + dev_set_drvdata/dev_get_drvdata */ + struct mutex mutex; /* mutex to synchronize calls to + * its driver. + */ + + struct dev_links_info links; + struct dev_pm_info power; + struct dev_pm_domain *pm_domain; + +#ifdef CONFIG_ENERGY_MODEL + struct em_perf_domain *em_pd; +#endif + +#ifdef CONFIG_PINCTRL + struct dev_pin_info *pins; +#endif + struct dev_msi_info msi; +#ifdef CONFIG_DMA_OPS + const struct dma_map_ops *dma_ops; +#endif + u64 *dma_mask; /* dma mask (if dma'able device) */ + u64 coherent_dma_mask;/* Like dma_mask, but for + alloc_coherent mappings as + not all hardware supports + 64 bit addresses for consistent + allocations such descriptors. */ + u64 bus_dma_limit; /* upstream dma constraint */ + const struct bus_dma_region *dma_range_map; + + struct device_dma_parameters *dma_parms; + + struct list_head dma_pools; /* dma pools (if dma'ble) */ + +#ifdef CONFIG_DMA_DECLARE_COHERENT + struct dma_coherent_mem *dma_mem; /* internal for coherent mem + override */ +#endif +#ifdef CONFIG_DMA_CMA + struct cma *cma_area; /* contiguous memory area for dma + allocations */ +#endif +#ifdef CONFIG_SWIOTLB + struct io_tlb_mem *dma_io_tlb_mem; +#endif +#ifdef CONFIG_SWIOTLB_DYNAMIC + struct list_head dma_io_tlb_pools; + spinlock_t dma_io_tlb_lock; + bool dma_uses_io_tlb; +#endif + /* arch specific additions */ + struct dev_archdata archdata; + + struct device_node *of_node; /* associated device tree node */ + struct fwnode_handle *fwnode; /* firmware device node */ + +#ifdef CONFIG_NUMA + int numa_node; /* NUMA node this device is close to */ +#endif + dev_t devt; /* dev_t, creates the sysfs "dev" */ + u32 id; /* device instance */ + + spinlock_t devres_lock; + struct list_head devres_head; + + const struct class *class; + const struct attribute_group **groups; /* optional groups */ + + void (*release)(struct device *dev); + struct iommu_group *iommu_group; + struct dev_iommu *iommu; + + struct device_physical_location *physical_location; + + enum device_removable removable; + + bool offline_disabled:1; + bool offline:1; + bool of_node_reused:1; + bool state_synced:1; + bool can_match:1; +#if defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE) || \ + defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU) || \ + defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU_ALL) + bool dma_coherent:1; +#endif +#ifdef CONFIG_DMA_OPS_BYPASS + bool dma_ops_bypass : 1; +#endif +}; + +/** + * struct device_link - Device link representation. + * @supplier: The device on the supplier end of the link. + * @s_node: Hook to the supplier device's list of links to consumers. + * @consumer: The device on the consumer end of the link. + * @c_node: Hook to the consumer device's list of links to suppliers. + * @link_dev: device used to expose link details in sysfs + * @status: The state of the link (with respect to the presence of drivers). + * @flags: Link flags. + * @rpm_active: Whether or not the consumer device is runtime-PM-active. + * @kref: Count repeated addition of the same link. + * @rm_work: Work structure used for removing the link. + * @supplier_preactivated: Supplier has been made active before consumer probe. + */ +struct device_link { + struct device *supplier; + struct list_head s_node; + struct device *consumer; + struct list_head c_node; + struct device link_dev; + enum device_link_state status; + u32 flags; + refcount_t rpm_active; + struct kref kref; + struct work_struct rm_work; + bool supplier_preactivated; /* Owned by consumer probe. */ +}; + +/** + * dev_name - Return a device's name. + * @dev: Device with name to get. + * Return: The kobject name of the device, or its initial name if unavailable. + */ +static inline const char *dev_name(const struct device *dev) +{ + /* Use the init name until the kobject becomes available */ + if (dev->init_name) + return dev->init_name; + + return kobject_name(&dev->kobj); +} + +#endif /* _DEVICE_TYPES_H_ */ diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index 32c2f49177b1..765f799d49bd 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h @@ -5,7 +5,7 @@ #ifndef LINUX_DMAENGINE_H #define LINUX_DMAENGINE_H -#include +#include #include #include // for struct ida #include diff --git a/include/linux/edac.h b/include/linux/edac.h index 7b78403cac40..08ba34f2a43e 100644 --- a/include/linux/edac.h +++ b/include/linux/edac.h @@ -13,7 +13,7 @@ #define _LINUX_EDAC_H_ #include -#include +#include #include #include #include diff --git a/include/linux/enclosure.h b/include/linux/enclosure.h index 1c630e2c2756..8fb9f561263f 100644 --- a/include/linux/enclosure.h +++ b/include/linux/enclosure.h @@ -12,7 +12,7 @@ #ifndef _LINUX_ENCLOSURE_H_ #define _LINUX_ENCLOSURE_H_ -#include +#include #include /* A few generic types ... taken from ses-2 */ diff --git a/include/linux/fpga/fpga-bridge.h b/include/linux/fpga/fpga-bridge.h index 223da48a6d18..3a1eeb26bd65 100644 --- a/include/linux/fpga/fpga-bridge.h +++ b/include/linux/fpga/fpga-bridge.h @@ -3,7 +3,7 @@ #ifndef _LINUX_FPGA_BRIDGE_H #define _LINUX_FPGA_BRIDGE_H -#include +#include #include struct fpga_bridge; diff --git a/include/linux/fpga/fpga-region.h b/include/linux/fpga/fpga-region.h index 9d4d32909340..be1e5033f0d3 100644 --- a/include/linux/fpga/fpga-region.h +++ b/include/linux/fpga/fpga-region.h @@ -3,7 +3,7 @@ #ifndef _FPGA_REGION_H #define _FPGA_REGION_H -#include +#include #include #include diff --git a/include/linux/framer/framer.h b/include/linux/framer/framer.h index 2352a52d7d0f..ebaacd782702 100644 --- a/include/linux/framer/framer.h +++ b/include/linux/framer/framer.h @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include /** diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h index 3bb87bf6bc65..5803588f86db 100644 --- a/include/linux/hdmi.h +++ b/include/linux/hdmi.h @@ -25,7 +25,7 @@ #define __LINUX_HDMI_H_ #include -#include +#include enum hdmi_packet_type { HDMI_PACKET_TYPE_NULL = 0x00, diff --git a/include/linux/hwmon-sysfs.h b/include/linux/hwmon-sysfs.h index d896713359cd..6b13b3e5a9b5 100644 --- a/include/linux/hwmon-sysfs.h +++ b/include/linux/hwmon-sysfs.h @@ -7,7 +7,7 @@ #ifndef _LINUX_HWMON_SYSFS_H #define _LINUX_HWMON_SYSFS_H -#include +#include #include struct sensor_device_attribute{ diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h index 6dafef342e91..91d67fdda784 100644 --- a/include/linux/iio/iio.h +++ b/include/linux/iio/iio.h @@ -7,7 +7,7 @@ #ifndef _INDUSTRIAL_IO_H_ #define _INDUSTRIAL_IO_H_ -#include +#include #include #include #include diff --git a/include/linux/lcd.h b/include/linux/lcd.h index 238fb1dfed98..a0deeeb3db49 100644 --- a/include/linux/lcd.h +++ b/include/linux/lcd.h @@ -9,7 +9,7 @@ #ifndef _LINUX_LCD_H #define _LINUX_LCD_H -#include +#include #include #include #include diff --git a/include/linux/node.h b/include/linux/node.h index c4c17037c954..791954e0f01b 100644 --- a/include/linux/node.h +++ b/include/linux/node.h @@ -15,7 +15,7 @@ #ifndef _LINUX_NODE_H_ #define _LINUX_NODE_H_ -#include +#include #include #include #include // for enum meminit_context diff --git a/include/linux/pm_clock.h b/include/linux/pm_clock.h index 68669ce18720..8b89565c6e6e 100644 --- a/include/linux/pm_clock.h +++ b/include/linux/pm_clock.h @@ -8,7 +8,7 @@ #ifndef _LINUX_PM_CLOCK_H #define _LINUX_PM_CLOCK_H -#include +#include #include struct pm_clk_notifier_block { diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h index 5b01ebf9c254..a2ec26d5cba9 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h @@ -8,7 +8,7 @@ #ifndef _LINUX_PM_DOMAIN_H #define _LINUX_PM_DOMAIN_H -#include +#include #include #include #include diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h index 4a69d4af3ff8..97234cba44e0 100644 --- a/include/linux/pm_qos.h +++ b/include/linux/pm_qos.h @@ -14,7 +14,7 @@ #include #include -#include +#include enum pm_qos_flags_status { PM_QOS_FLAGS_UNDEFINED = -1, diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index 2bcf998da2a7..762ffc2c5dc2 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h @@ -12,7 +12,7 @@ #ifndef __LINUX_POWER_SUPPLY_H__ #define __LINUX_POWER_SUPPLY_H__ -#include +#include #include #include #include diff --git a/include/linux/powercap.h b/include/linux/powercap.h index 3d557bbcd2c7..da48bd9bcdd7 100644 --- a/include/linux/powercap.h +++ b/include/linux/powercap.h @@ -7,7 +7,7 @@ #ifndef __POWERCAP_H__ #define __POWERCAP_H__ -#include +#include #include /* diff --git a/include/linux/rtc.h b/include/linux/rtc.h index 98401e771e75..82cb7f0fd843 100644 --- a/include/linux/rtc.h +++ b/include/linux/rtc.h @@ -34,7 +34,7 @@ static inline time64_t rtc_tm_sub(struct rtc_time *lhs, struct rtc_time *rhs) return rtc_tm_to_time64(lhs) - rtc_tm_to_time64(rhs); } -#include +#include #include #include #include diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h index c37473373649..94aa8de02ea7 100644 --- a/include/linux/swiotlb.h +++ b/include/linux/swiotlb.h @@ -2,7 +2,7 @@ #ifndef __LINUX_SWIOTLB_H #define __LINUX_SWIOTLB_H -#include +#include #include #include #include @@ -10,7 +10,6 @@ #include #include -struct device; struct page; struct scatterlist; diff --git a/include/linux/thermal.h b/include/linux/thermal.h index f58dcf5712ad..b2722cffdb3e 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -12,7 +12,7 @@ #include #include -#include +#include #include #include #include diff --git a/include/linux/w1.h b/include/linux/w1.h index 9a2a0ef39018..3cbc5e0bab9d 100644 --- a/include/linux/w1.h +++ b/include/linux/w1.h @@ -6,7 +6,7 @@ #ifndef __LINUX_W1_H #define __LINUX_W1_H -#include +#include /** * struct w1_reg_num - broken out slave device id diff --git a/include/media/cec.h b/include/media/cec.h index 085dd6a526c8..92fae6461437 100644 --- a/include/media/cec.h +++ b/include/media/cec.h @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/include/media/media-devnode.h b/include/media/media-devnode.h index d27c1c646c28..e690f171c67e 100644 --- a/include/media/media-devnode.h +++ b/include/media/media-devnode.h @@ -18,7 +18,7 @@ #include #include -#include +#include #include struct media_device; diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h index 5dee575fbe86..9b8991560a3e 100644 --- a/include/net/nfc/nfc.h +++ b/include/net/nfc/nfc.h @@ -12,7 +12,7 @@ #define __NET_NFC_H #include -#include +#include #include #define nfc_dbg(dev, fmt, ...) dev_dbg((dev), "NFC: " fmt, ##__VA_ARGS__) diff --git a/include/pcmcia/ss.h b/include/pcmcia/ss.h index 694e5ae0f245..4bf85a0cfa5e 100644 --- a/include/pcmcia/ss.h +++ b/include/pcmcia/ss.h @@ -12,7 +12,7 @@ #ifndef _LINUX_SS_H #define _LINUX_SS_H -#include +#include #include /* task_struct, completion */ #include diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index c70aafd415b5..74c9a6d165ac 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -2,6 +2,7 @@ #ifndef _SCSI_SCSI_DEVICE_H #define _SCSI_SCSI_DEVICE_H +#include // for device_reprobe() #include #include #include diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index d5d94510afd3..6c61c24b53cf 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include -- 2.39.2