Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp195845pxb; Wed, 18 Aug 2021 19:53:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxere0cJ/uZirY5EEgX/nKqxBLZCJYbzBIowAc+g7zkxczuyV0zcsP8Akn6vwoa2cPPLYyI X-Received: by 2002:a5d:8907:: with SMTP id b7mr9750890ion.124.1629341624674; Wed, 18 Aug 2021 19:53:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629341624; cv=none; d=google.com; s=arc-20160816; b=OQuJamOc8wC1Eeu//83jE8twttrnPeKrDic2UioGSVs2TrQer2qwQqhcRwfIhekfpe ISr+7fJ2u60zjldZFpjca5pa17tjCSXqFEgiar1wnj05Z4xPkx7GG/mpnWzK2o7QYqox 4d2IlvLVs5BYeZjnurlQLOjzV1R6VXS1UQZ+Irvl5If0t1SM+8gtbU47SoTNy/pEj7eL 49CUJOgsdp7EsmVTn3xQA8paYyugH6M/Pw+6qXnJOlcYtlcKBdo9fTnL+gGfhuJhvDrt Z48OlvNx4IiWUfoFZhi+jFjf04JZF6aYGQSThNBAlqgsqDD/WFxApQX2iUEkhRqiZeJm CySw== 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=aRx3WSbHN2621ogL+fq9TI54goN5jX542hotfGdhgzw=; b=z1HA5/Lv+RA/0r2+Inmuo6m+MDy/pdAczg+MDIlsKBuVD1z1qIg5V2aWEqUrZ/JYYe RNfg6RNrsba384oZZ7Qg9b7q2d3F8KlOkuxNwyYE6QFOrxXBVLuSUhkuu4IQpTPnW2Kk JxtS49XxUxB1rU4G2rZz+/7k/bJ5lWWqSAoqwJ8jjKFDgY7HF4zheVmvV3YkdsO6P0kY 0esO8CPozssJvZwX0uMepT/A/fUbvcnJRkQD0Yvr1OB5lp+SrC7BiepbbpSRyy9gOQC6 GkV+W5uJJya4onA/VHOQ8ic7gTxSiC6J5dTYytQmLyP1jg+1d/uDJXhZiDNR3e/7tYkY i9sA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=mkWoo3nC; 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 y5si1572381ion.91.2021.08.18.19.53.33; Wed, 18 Aug 2021 19:53:44 -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=mkWoo3nC; 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 S235957AbhHSCw0 (ORCPT + 99 others); Wed, 18 Aug 2021 22:52:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236292AbhHSCwC (ORCPT ); Wed, 18 Aug 2021 22:52:02 -0400 Received: from mail-ot1-x32f.google.com (mail-ot1-x32f.google.com [IPv6:2607:f8b0:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0666C0612A8; Wed, 18 Aug 2021 19:51:17 -0700 (PDT) Received: by mail-ot1-x32f.google.com with SMTP id l36-20020a0568302b24b0290517526ce5e3so6809182otv.11; 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=aRx3WSbHN2621ogL+fq9TI54goN5jX542hotfGdhgzw=; b=mkWoo3nCDSds4T6Pec/mDgTgogMejNa+jb5y5TNgUo5dQSgA9J2IozvxbsAcq8wKfV 7AeHMMvkxEQEa2TJf921T6s+7vqzAhBMwgK3eOlmXrNhDtZnG4Y2+U0wA6cC6FQhj3x2 PV8Qu0E4GcYvx60HEwcQNOeXGQb9jHrXAIQHGvSMoKYhh/oYgFmGIqjRpg7hegxzBxzI MejAfRc16AAyIVouwqzmlrngD2LwB03N/9C/nZ3Z/qatAexqxgGuA9a4T00BPDcetiSM MvUMaEGFrJtNLCI++/LgBdhQucNPoFfPAAHta0970g4FjJ/YVsKHed1lbuH28YHB1El+ zqrQ== 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=aRx3WSbHN2621ogL+fq9TI54goN5jX542hotfGdhgzw=; b=htRFrgEpPzaz9h3mi5BOMSswMBOyHk6tPNXuw7b+bwTDvGukv2Xcg4uSSuymqGHtHg FslNgGR4oH8KeeCzWGwDeKOEU9rBzJLifAcoj9oukeVFu6DoSJFBcymWRwebKIyvIR6U 9d8iAeccp7AkZKSx0cySmbxmS0mYmb4HhIDQtUctIyLDVk2tAtQbivz2DjQ7p6NgblvH xVIEgW6jCIZVpjmx2X46m+RNb3rn6Vsbg34z3MTImQDJEjLvQcTjlXN2WNes6XmF1wLu xZZOucFJxxVkuwXIkuZGOO2LzvrLLkl+kUJlBbZwOcrRkxf1bUq7RXzdgbkxZuBeBHGp KhLg== X-Gm-Message-State: AOAM531eR9yzJ9nbXY/DXvuJq4IczIlcD4Mf1Fn1y3Ev6QGFGHlOqBal /vytvivbw8v1IxXVMtORQUbfNRiheDvonnbW X-Received: by 2002:a05:6830:31ac:: with SMTP id q12mr9836670ots.152.1629341477061; Wed, 18 Aug 2021 19:51:17 -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.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 19:51:16 -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 17/18] ledtrig-blkdev: Add initialization function Date: Wed, 18 Aug 2021 21:50:52 -0500 Message-Id: <20210819025053.222710-18-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 Register the block device LED trigger Initialize interval (convert default value to jiffies) Signed-off-by: Ian Pilcher --- drivers/leds/trigger/ledtrig-blkdev.c | 39 +++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/drivers/leds/trigger/ledtrig-blkdev.c b/drivers/leds/trigger/ledtrig-blkdev.c index 01573c1ad855..f152b00a4f1a 100644 --- a/drivers/leds/trigger/ledtrig-blkdev.c +++ b/drivers/leds/trigger/ledtrig-blkdev.c @@ -729,3 +729,42 @@ static void blkdev_deactivate(struct led_classdev *const led_dev) mutex_unlock(&ledtrig_blkdev_mutex); } + + +/* + * + * Initialization - register the trigger + * + */ + +static struct attribute *ledtrig_blkdev_attrs[] = { + &ledtrig_blkdev_attr_add.attr, + &ledtrig_blkdev_attr_del.attr, + &ledtrig_blkdev_attr_blink_time.attr, + &ledtrig_blkdev_attr_interval.attr, + &ledtrig_blkdev_attr_mode.attr, + NULL +}; + +static const struct attribute_group ledtrig_blkdev_attr_group = { + .attrs = ledtrig_blkdev_attrs, +}; + +static const struct attribute_group *ledtrig_blkdev_attr_groups[] = { + &ledtrig_blkdev_attr_group, + NULL +}; + +static struct led_trigger ledtrig_blkdev_trigger = { + .name = "blkdev", + .activate = blkdev_activate, + .deactivate = blkdev_deactivate, + .groups = ledtrig_blkdev_attr_groups, +}; + +static int __init blkdev_init(void) +{ + ledtrig_blkdev_interval = msecs_to_jiffies(LEDTRIG_BLKDEV_INTERVAL); + return led_trigger_register(&ledtrig_blkdev_trigger); +} +device_initcall(blkdev_init); -- 2.31.1