Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp195294pxb; Wed, 18 Aug 2021 19:52:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzksqPiIO87OkshefTViD8hLJmX7UaMtUxwDlPfLLijQdON9/hELGm1pDBaFBEaXdRJDRWI X-Received: by 2002:a05:6e02:d03:: with SMTP id g3mr8352600ilj.127.1629341550352; Wed, 18 Aug 2021 19:52:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629341550; cv=none; d=google.com; s=arc-20160816; b=l6rwV+vZAaK0wJErbt19yzs6DK4R56HRzV1ThZ6Nyqteb7btnJ9A0jdq3+HmByJ4rH P4KikiN08IklbOWfjAvNDQTb9d/w15elH333xu+E7njoAqxCcL+XuHzmRbJZyKbJJ+h8 /3wcORybQbDFjyEP3jAP0gR13de2OJ+LlGT4FWqqyTzmCFYlDsxTSnzCSLG3vmsa1Udf BeQXs8X/IOZ+RC92Ui1XLYRsYi9XyjINT+t8WZemEYTIta7OSLLLMWpoa8M8Tbz4cuqg f/Ix55dEbByN2I7PW/f79Od504nm53DXilQz8KFJ7WPcg8j0CHP8oDKloF3L86GeQ+ER Uw3Q== 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=BkKk5IdQRzWklzG7HN3qRXs0xk7AxusQvu7aSpQWfNY=; b=0saau38E6J+MsbM12JXOU3MBmDrLYm5nWYH/h/ROxtVzr5OeN4oVTlp1iE/8ZuUvrn xHz+ArnMr9v3niI8/IwanDYX9M2Ntl620Ra9XaZyqewvMB1N+sHxLHvpXuw9TJ4Zzmw1 ZBQJK/gr4RVKG70zOAVQd0DKEbk3HvyFTrEHKCVHehHyoH7FgYdc5iG1e0vzX8UTbQKL PQFOyy6j7B6FGtIXbmZdjyz2PvbhJg5s5hLXUqY6CPQXPeCNvSeAVhmM4fgm838J6L+r jdraNHPZVNpOdKiQFuaciPC7CKYIbkuofnJhu4jer/ESdGFaI4Bursa1LUb91cRM/Z43 ooVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=d35Xzzvr; 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 y26si1630911jan.75.2021.08.18.19.52.19; Wed, 18 Aug 2021 19:52:30 -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=d35Xzzvr; 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 S236220AbhHSCwA (ORCPT + 99 others); Wed, 18 Aug 2021 22:52:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235838AbhHSCvp (ORCPT ); Wed, 18 Aug 2021 22:51:45 -0400 Received: from mail-ot1-x32c.google.com (mail-ot1-x32c.google.com [IPv6:2607:f8b0:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAB78C061764; Wed, 18 Aug 2021 19:51:09 -0700 (PDT) Received: by mail-ot1-x32c.google.com with SMTP id w22-20020a056830411600b0048bcf4c6bd9so6844440ott.8; Wed, 18 Aug 2021 19:51:09 -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=BkKk5IdQRzWklzG7HN3qRXs0xk7AxusQvu7aSpQWfNY=; b=d35XzzvrkYne8EgQl4IWEEGQcIsB5mM2CgVGd4U2m0dJP0+ttUMD1knAkSdg4UBuig c91p2X25gK6cmvA6wExYn298f2n/lpFmWU4XLxy2G7vMthM/vePscjReNCcQHc+5BEs/ r7lUWYwxjqPcBSDInCVSICp4MJk0nWD8JDP0y1WIUa7i8dR88zJss7VurRa2tTn2e/hy ry+tYU56dhhpaEYwgLI1txRcM0dFCdFcdvoQPpAB6Hb+yb1seBIbnWKtVI5hfGzriOBl HTTr49BFbX5sPEn6fkiGKUA+LZwRLoz34moSGyQXI77wtm0QhvtoTzV9uX+w+ePhTDLT cUig== 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=BkKk5IdQRzWklzG7HN3qRXs0xk7AxusQvu7aSpQWfNY=; b=N0Y0GH+a4/9wE8bRqmsK5Vse2plZACcXsOdKdCBoOJQJaOr7yX9kd04moBC5lwzsyU uwc5Wj7RmNmWyEicVsb9PQRG/+hZdwJN+zF3gmk1zYncKLD5ZIygOiJKDhHSQKiZz1Bk LmSHvRZef+rtjnmVTx3+vhtxdGvbMP2tqjxujR1yBk71Wn5gYH1qWeAqi4bQDx+/UHPg R4afdwAG5hOTFAWlSqgHAhYUZ7/oRj2/w8X4TVbfGTCPPMvHC4ZuSELxefsVplFNmzdH 09F7hF0rlXEx45oMlopHyhzvAkeaseP8CEHZB3nR6mvpS2vqOHZBvpzh8Ww9ZJkBMl7u xzVA== X-Gm-Message-State: AOAM5323MovSDNzv2I08wAjbNr23l3wb5Wj18BmjnF4yEW8KjOsCU3m/ uk/7U3tCbGvYoHVsvMsErkEvxZz/zF+UKVia X-Received: by 2002:a9d:6e0a:: with SMTP id e10mr6439459otr.259.1629341469018; Wed, 18 Aug 2021 19:51:09 -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.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 19:51:08 -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 07/18] ledtrig-blkdev: Add function to initialize gendisk ledtrig member Date: Wed, 18 Aug 2021 21:50:42 -0500 Message-Id: <20210819025053.222710-8-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 Ensures that gendisk ledtrig member is initialized to NULL, in case the structure was not allocated with kzalloc() or equivalent Signed-off-by: Ian Pilcher --- include/linux/leds.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/linux/leds.h b/include/linux/leds.h index 329fd914cf24..6b67650d8797 100644 --- a/include/linux/leds.h +++ b/include/linux/leds.h @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -599,4 +600,19 @@ static inline void ledtrig_audio_set(enum led_audio type, } #endif +#ifdef CONFIG_LEDS_TRIGGER_BLKDEV +/** + * ledtrig_blkdev_disk_init - initialize the ledtrig field of a new gendisk + * @gd: the gendisk to be initialized + */ +static inline void ledtrig_blkdev_disk_init(struct gendisk *const gd) +{ + gd->ledtrig = NULL; +} +#else /* CONFIG_LEDS_TRIGGER_BLKDEV */ +static inline void ledtrig_blkdev_disk_init(const struct gendisk *gd) +{ +} +#endif /* CONFIG_LEDS_TRIGGER_BLKDEV */ + #endif /* __LINUX_LEDS_H_INCLUDED */ -- 2.31.1