Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp195675pxb; Wed, 18 Aug 2021 19:53:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz7dBhDh5sDZQCVrXfhhEpps1nO8/nxL6RMVirHukdiQ2oU+JMfzCYtbOfycrpvZwy78ifj X-Received: by 2002:a5e:d80c:: with SMTP id l12mr2128938iok.120.1629341599908; Wed, 18 Aug 2021 19:53:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629341599; cv=none; d=google.com; s=arc-20160816; b=i967l+gVOFsJg+Bx3kZqBYPOymbRBfeePrPq4QcFNSxOyrrjEukWITw7hlp2Kn6ySZ NWlPJwPL13qVV5teGzxFB4WydvKB+suR7Gy4OUWOFU3sXeVWGchMQ4XkfD8+CYK7xqoI LPQiiquXJTn/+aQP1A3wl8i1DymgYYd12ty40/cvZMptUPHE7F0xJZKeSUcwFMfjgeGi fYkVyMfVaOkMidSUFa7nq+c1INOF4zy3Q/BiljAvVuOIiQ5a2ZfrFCiY/taFwpYitaD7 tsLM50sAlcfkOko6tUoskdmuZrdcO63Ks5yGXefHpEYCbrwZj+XGEouQReDtYW0joKi4 8N4w== 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=NFCrLsUf9iuGl/q7hZ+9DQ2aeBND1LI3Kn0Axyc++as=; b=jt2l96pVIba1I6fCr+pHB4Cl/ENxzQXhn9pqL0V5lhOxbw6lIwhKjgXirQG3EQZuKg nk9PjaiHEEn3gAPYpfwMYpCwBbSkqGS/GrebfaTQfSEyox1qE/9DBFf0SyweUgS6di0M O7K66cAHpm9B4TQoj4GJ7BELI3/HeNQ4p7YtAdPwbUE3UZ9ERoA/BQAe3W/pltpTPbs5 J9FP0n2kxiKNFN0aXr7lCDoV9vzs2P5e0IEDY+fcvon1Yxq564HwaqFBcujuQ40dJrei tNWHuRidPm2pS+QyLVBYAy7BmLBjwEZrPJo7TYrIoRYc+egodmGsSert9xcOoIkFf0ke vDdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OYfl89r0; 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 q20si1691625ilj.61.2021.08.18.19.53.08; Wed, 18 Aug 2021 19:53:19 -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=20161025 header.b=OYfl89r0; 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 S236119AbhHSCw1 (ORCPT + 99 others); Wed, 18 Aug 2021 22:52:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236290AbhHSCwC (ORCPT ); Wed, 18 Aug 2021 22:52:02 -0400 Received: from mail-oo1-xc29.google.com (mail-oo1-xc29.google.com [IPv6:2607:f8b0:4864:20::c29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C0F5C0612A6; Wed, 18 Aug 2021 19:51:17 -0700 (PDT) Received: by mail-oo1-xc29.google.com with SMTP id h7-20020a4ab4470000b0290263c143bcb2so1381839ooo.7; Wed, 18 Aug 2021 19:51:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NFCrLsUf9iuGl/q7hZ+9DQ2aeBND1LI3Kn0Axyc++as=; b=OYfl89r0BeFvZj9WgsBh4ULLcCMgIlMtVpPcn7MgL8jU9BnXFYrl9ewYrBaoCHYYcK jH4ZzAZ+JiBJ+j1YlY/SrDh379Vb+tK8lNJOEyIihErgf015nK5Ek9uYy7Bkd1YLv3wd eFov81p24ptv31Eaa0wnHqdaJcDkebr8FpntNtJhHCzeywdtAlaxwwYBk/ZGmKeRRss4 H+ai5iRW8wXt6wGuX1B+hZi2hLyUvkLAVM2Tj8EfZXzgazZuGz2tCfGOq/YHjAFsotJN F1rltQ4NaDL+6gCjkDwTq5ztKzRVp52j9oNS0GO06Qsqw+LjET5cvfYxPyY8wqOB3+Wj XeXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NFCrLsUf9iuGl/q7hZ+9DQ2aeBND1LI3Kn0Axyc++as=; b=tnvPKmDXPGbEJ8KqIEgH7aeLIjxfqKniRRzOuoIKmuMrKeQKR/Cekk225/HBQV3XCc widGBxYbR3FHlFJkFBmADE1AwoRs1KBxeZDSZiqOWkgNjis9HuStUHQEA4vxV2mPyfGD ViSUtw4Ryn/aEaXXVAl6YiYocXyBTxQ79YfNX8fbLTZazNmhxxQGgkZNiqIMR+iOELd8 uoK0FcOWUfgLAF2z621XYrs1VXegRKT/O1WBtILJizr4EGWX/80P6m2FhNJXiH35scSK KsRndg4S91+rSIQ1BzsbhMIvaivRk6jkKpcW7AjJF3lFkWpv+yVqGZmN3vT8oy5fcSZB E/2Q== X-Gm-Message-State: AOAM5315GrAlhuwHWa8/U7ZMHMYLLcCG5nJgL/0Q1ChrUK3EtLudbS5P b25Yvcrgld/4JTZMDL4ArwJ7dE70aW87O7rP X-Received: by 2002:a4a:3f01:: with SMTP id e1mr9521891ooa.86.1629341476315; Wed, 18 Aug 2021 19:51:16 -0700 (PDT) Received: from ian.penurio.us ([47.184.51.90]) by smtp.gmail.com with ESMTPSA id w15sm156792oiw.19.2021.08.18.19.51.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 19:51:15 -0700 (PDT) From: Ian Pilcher To: linux-block@vger.kernel.org, linux-leds@vger.kernel.org Cc: axboe@kernel.dk, pavel@ucw.cz, kabel@kernel.org, linux-kernel@vger.kernel.org, kernelnewbies@kernelnewbies.org Subject: [RFC PATCH v3 16/18] ledtrig-blkdev: Add function to disassociate an LED from the trigger Date: Wed, 18 Aug 2021 21:50:51 -0500 Message-Id: <20210819025053.222710-17-arequipeno@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210819025053.222710-1-arequipeno@gmail.com> References: <20210819025053.222710-1-arequipeno@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Remove all device associations with this LED Remove /sys/class/leds//block_devices directory Free per-LED data structure Signed-off-by: Ian Pilcher --- drivers/leds/trigger/ledtrig-blkdev.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/leds/trigger/ledtrig-blkdev.c b/drivers/leds/trigger/ledtrig-blkdev.c index b331e3f24b04..01573c1ad855 100644 --- a/drivers/leds/trigger/ledtrig-blkdev.c +++ b/drivers/leds/trigger/ledtrig-blkdev.c @@ -704,3 +704,28 @@ static int blkdev_activate(struct led_classdev *const led_dev) exit_return: return ret; } + + +/* + * + * Disassociate an LED from the trigger + * + */ + +static void blkdev_deactivate(struct led_classdev *const led_dev) +{ + struct ledtrig_blkdev_led *const led = led_get_trigger_data(led_dev); + struct ledtrig_blkdev_link *link; + struct hlist_node *next; + + mutex_lock(&ledtrig_blkdev_mutex); + + hlist_for_each_entry_safe(link, next, &led->disks, led_disks_node) + blkdev_disk_del_locked(led, link, link->disk); + + hlist_del(&led->leds_node); + kobject_put(led->dir); + kfree(led); + + mutex_unlock(&ledtrig_blkdev_mutex); +} -- 2.31.1