Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp921892pxb; Thu, 9 Sep 2021 15:27:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvrDvr5nHgg4v+qRfyOGlNdOMhA3bAa8KJ91b4QhrsGS1xrTNES+3bq3H1vGQTyudcE48X X-Received: by 2002:a02:c80b:: with SMTP id p11mr1877091jao.122.1631226444668; Thu, 09 Sep 2021 15:27:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631226444; cv=none; d=google.com; s=arc-20160816; b=RbDvoZ7LwLmOjLdjkssp7Usuzsl1zIFSfb9iy9BtKCD56YMn4cOZ9kBttKzXp+QTEn jwJxeloMbXBEEr21lTM70HwYd3Mydx18O/vulYsV6NGLBF77ROgid+pvnhZDtTVLVzuU E2y+7QIzqgEQ5OCmi6I23eqrAm64hF1gvxwHdUs432y5Uc91gPeIJ9tWH44IhQvPCbtD +Zh8Y2Tjsd2ou1W3uMKky8uJ+Lp5+fRvpHZIHEp/11VlAiq9RJGsjnAoXq0a8PjzSMEY Endm7V9dvNU0/cArcYKFe4cBLwo4ehb1el+GrbU3jRqu5v7CO26OMUmw3+Q1D/z/zjid jTNA== 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=5IvB2ie/eR/p0ZXjKpNOoLs51YY8X2DxXyaLyjEGU5s=; b=g2e3wR/pkB7IEwXcaKhu1sGzbIfgTorpK2MItt5/gxdNvosypALFQlMA+7pJblA7YP 0fJyLlb4jsqHE/GptcZ+BAUuXcyyMhwOrYtHyarirJfwup8QeTZ0z2SUJa04CFvq0uVl twjOP2zkHLTaC1rAT7rm88+vN6wqf24IzP76dOMeELG8zkZPSQ1zLRjSQjCCs/arqogg EOYLrlz8hfCKairMQ2u27TB2CJKRGSttAI9zMDXs9qoMQWSM9IEfoof9//9WWjdRYqeW Q0Ry8g0Ma/76wFkD8SFItMq6eHzTDQP/D0Ov4+UZFacZ8biL0W6Dmc7gA8JdTc9BYRVM whXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=O7Lrxvdj; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 132si3125563jay.7.2021.09.09.15.27.10; Thu, 09 Sep 2021 15:27:24 -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=@gmail.com header.s=20210112 header.b=O7Lrxvdj; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348814AbhIIW07 (ORCPT + 99 others); Thu, 9 Sep 2021 18:26:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345073AbhIIW0f (ORCPT ); Thu, 9 Sep 2021 18:26:35 -0400 Received: from mail-oo1-xc35.google.com (mail-oo1-xc35.google.com [IPv6:2607:f8b0:4864:20::c35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EB8CC061756; Thu, 9 Sep 2021 15:25:25 -0700 (PDT) Received: by mail-oo1-xc35.google.com with SMTP id y3-20020a4ab403000000b00290e2a52c71so1071222oon.2; Thu, 09 Sep 2021 15:25:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5IvB2ie/eR/p0ZXjKpNOoLs51YY8X2DxXyaLyjEGU5s=; b=O7Lrxvdjp9rmXnWXN6cN3wCovZwHVrpRw+J8dHaOE1IHnLxOyOprFhm6t6nkjJ0XLn c3PxliT2pHGWQqNcuht6a3BVZKYFVd3FkYRTXpa4k4UqCCG+ZkPyyTHdbmMsQSc+1Oyl 3vRABWfn2lUyrAfshml7FY0iuvmcgzlZ2NJNZqPVnUNwhU8kqPxIatF9AJOGIkt7vP// S08grsbyjPbrBTkcv37taFMoV53FpoinEskk3u7DjiHeKbQZ3KIPzANwudBLwyua7cIe 2iKFiSAacrC1RSJ7lujclmKJvzKylL7lRvs7XJdBClyMCYmLIo28iNYEXS9C5QxXxOBN FcBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5IvB2ie/eR/p0ZXjKpNOoLs51YY8X2DxXyaLyjEGU5s=; b=aL0eRcdY2n8/bySCvhJdp8ldr621fSmX+gwMJR4O/npa4PkSoQxx1UDswaIhZlWXuj J2aTbU0+Nl/W7628cnn36qD4702cMm8+IiNiV5IpgttgkCcgJlkReJsFtvdjmIn6ynYb 4Mza/Ra8Bms6PtutChzFr/X77hiaP0RMZU5k9W2MYu7FO09IEOcyxt6rOmHysu5zCRsZ hmSemHH5ycMX6qLTcAha5Xa5VlrM5WZq81x1ISG+uwOg8Ba7alogg0/FHnG6kBdQtYZO WA/zrslq7MF28X60SkgUJATXZdTJ92HtPHFCHlrX0NkC2YKt9vt4vmnqdTEifPgCQmgr 0iow== X-Gm-Message-State: AOAM530AduKtcgUWKuLRgF1x2btp8VKEP66x4vojI9iQwHNphwAf1uJq lzSzBL8J3t/K06qiGrFaO70= X-Received: by 2002:a4a:e942:: with SMTP id v2mr1798582ood.96.1631226324934; Thu, 09 Sep 2021 15:25:24 -0700 (PDT) Received: from ian.penurio.us ([47.184.51.90]) by smtp.gmail.com with ESMTPSA id 4sm747293oil.38.2021.09.09.15.25.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Sep 2021 15:25:24 -0700 (PDT) From: Ian Pilcher To: axboe@kernel.dk, pavel@ucw.cz Cc: linux-leds@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org, kabel@kernel.org Subject: [PATCH v2 04/15] block: Add block device LED trigger integrations Date: Thu, 9 Sep 2021 17:25:02 -0500 Message-Id: <20210909222513.2184795-5-arequipeno@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210909222513.2184795-1-arequipeno@gmail.com> References: <20210909222513.2184795-1-arequipeno@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add LED trigger disk info pointer to gendisk structure Call ledtrig_blkdev_disk_init() from device_add_disk() to ensure that ledtrig is initialized to NULL, in case a driver allocates the structure itself and doesn't use kzalloc() Call ledtrig_blkdev_disk_cleanup() from del_gendisk() to ensure that the LED trigger stops trying to check the disk for activity Signed-off-by: Ian Pilcher --- block/genhd.c | 4 ++++ include/linux/genhd.h | 3 +++ 2 files changed, 7 insertions(+) diff --git a/block/genhd.c b/block/genhd.c index 567549a011d1..6f340a717099 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -24,6 +24,7 @@ #include #include #include +#include #include "blk.h" @@ -390,6 +391,8 @@ int device_add_disk(struct device *parent, struct gendisk *disk, struct device *ddev = disk_to_dev(disk); int ret; + ledtrig_blkdev_disk_init(disk); + /* * The disk queue should now be all set with enough information about * the device for the elevator code to pick an adequate default @@ -559,6 +562,7 @@ void del_gendisk(struct gendisk *disk) if (WARN_ON_ONCE(!disk_live(disk) && !(disk->flags & GENHD_FL_HIDDEN))) return; + ledtrig_blkdev_disk_cleanup(disk); blk_integrity_del(disk); disk_del_events(disk); diff --git a/include/linux/genhd.h b/include/linux/genhd.h index c68d83c87f83..29039367ccad 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h @@ -166,6 +166,9 @@ struct gendisk { #endif /* CONFIG_BLK_DEV_INTEGRITY */ #if IS_ENABLED(CONFIG_CDROM) struct cdrom_device_info *cdi; +#endif +#if IS_ENABLED(CONFIG_LEDS_TRIGGER_BLKDEV) + struct ledtrig_blkdev_disk *ledtrig; #endif int node_id; struct badblocks *bb; -- 2.31.1