From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C565C4338F for ; Thu, 29 Jul 2021 05:52:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 52B9460C51 for ; Thu, 29 Jul 2021 05:52:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233900AbhG2FwY (ORCPT ); Thu, 29 Jul 2021 01:52:24 -0400 Received: from new4-smtp.messagingengine.com ([66.111.4.230]:39645 "EHLO new4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233739AbhG2FwX (ORCPT ); Thu, 29 Jul 2021 01:52:23 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id A7FAA5803F8; Thu, 29 Jul 2021 01:52:16 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Thu, 29 Jul 2021 01:52:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kroah.com; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm1; bh=viiBn1GywulERgvrKcCmkXUyuBc +hfV25KNyhlk4biE=; b=UvBUR3YSV1Hzv1rHB+81W9W34BIL1FI5U6cXTigUmL/ 46ODEIp8Kx7bAynesl+dIL6v0Q/iXqjtQjguo7w4zE3oFJmZrjaMWM35HTzcO+Hr PB9LgXc0v5rVc7Vvs7UYo8BoeeKpFqdtXJOiniOQOHV2q4uK65Dd90Rp/hyXsVaO ZyDgV36GQw673DE9qDtLLtPZZ+gJMflXvxKYAJigEGFJkHgyHSFn92Ytml0j/zxj WVaViCDv+ftKZZ9HBUnTjXcoSk24ubmoPSZDzxv8vDLFHX9MPuyTpsMn/CeooxP5 KvEmLHuOcRgK7S1kKNM28yfZfqkvPfXXHp2PoKabXew== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=viiBn1 GywulERgvrKcCmkXUyuBc+hfV25KNyhlk4biE=; b=ZPwAAszRN1awh/jGyBm78/ 7vUhL5y7FGte7hlzU3CkqzNtuO0eFM9XdbR3OnSo3skQrB3FCatPPsvmtLgHmCZd yo9+sZpuF/OqKytUSJu/nHwMn+5Y86MV+P0fSF+RJSh5E6ftRc/LKe9CdqcC6Ed8 +MSGjkmwFHprHRF/1eJDXgAK8vQA4ZyrR1zI9sM9LIJYj4ylG5EylMHuGTSa3sK2 OzRPmC4lfiLhN/OnsS/JkxAoo603S/yHPPHVCaeaIvYgsCZzIny3oHyvOh+xTDRc +Z7j9wEOzFp1Yj54n7mQXia+oHSUliWVY9gVFMvZriImJ6aB/VZ6pB13YMH6MCxg == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrhedtgdeltdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepfffhvffukfhfgggtuggjsehttdertd dttddvnecuhfhrohhmpefirhgvghcumffjuceoghhrvghgsehkrhhorghhrdgtohhmqeen ucggtffrrghtthgvrhhnpeevueehjefgfffgiedvudekvdektdelleelgefhleejieeuge egveeuuddukedvteenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhl fhhrohhmpehgrhgvgheskhhrohgrhhdrtghomh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 29 Jul 2021 01:52:15 -0400 (EDT) Date: Thu, 29 Jul 2021 07:52:11 +0200 From: Greg KH To: Ian Pilcher Cc: linux-block@vger.kernel.org, linux-leds@vger.kernel.org, axboe@kernel.dk, linux-kernel@vger.kernel.org, pavel@ucw.cz, kernelnewbies@kernelnewbies.org Subject: Re: [RFC PATCH 3/8] block: Add kernel APIs to create & delete block device LED triggers Message-ID: References: <20210729015344.3366750-1-arequipeno@gmail.com> <20210729015344.3366750-4-arequipeno@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210729015344.3366750-4-arequipeno@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org On Wed, Jul 28, 2021 at 08:53:39PM -0500, Ian Pilcher wrote: > * New file - include/linux/blk-ledtrig.h > > Signed-off-by: Ian Pilcher > --- > block/blk-ledtrig.c | 152 ++++++++++++++++++++++++++++++++++++ > include/linux/blk-ledtrig.h | 19 +++++ > 2 files changed, 171 insertions(+) > create mode 100644 include/linux/blk-ledtrig.h > > diff --git a/block/blk-ledtrig.c b/block/blk-ledtrig.c > index 345a3b6bdbc6..c69ea1539336 100644 > --- a/block/blk-ledtrig.c > +++ b/block/blk-ledtrig.c > @@ -6,9 +6,11 @@ > * Copyright 2021 Ian Pilcher > */ > > +#include > #include > #include > #include > +#include > > > /* > @@ -49,3 +51,153 @@ static struct blk_ledtrig *blk_ledtrig_find(const char *const name, > > return NULL; > } > + > + > +/* > + * > + * Create a new trigger > + * > + */ > + > +static int __blk_ledtrig_create(const char *const name, const size_t len) > +{ > + struct blk_ledtrig *t; > + int ret; > + > + if (len == 0) { > + pr_warn("empty name specified for blockdev LED trigger\n"); > + ret = -EINVAL; > + goto create_exit_return; > + } > + > + ret = mutex_lock_interruptible(&blk_ledtrig_list_mutex); > + if (unlikely(ret != 0)) Only ever use likely/unlikely if you can measure the difference without it. Otherwise the CPU and compiler will almost always get it right and you should not clutter up the code with them at all. For something like this function, where there is no speed difference at all, there is no need for these types of markings, so I would recommend just removing them all from your patchset. thanks, greg k-h From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BEC7C4338F for ; Thu, 29 Jul 2021 06:11:00 +0000 (UTC) Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D152F60524 for ; Thu, 29 Jul 2021 06:10:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D152F60524 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kroah.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kernelnewbies.org Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.94.2) (envelope-from ) id 1m8yz4-0002Ih-LI; Thu, 29 Jul 2021 01:53:30 -0400 Received: from new4-smtp.messagingengine.com ([66.111.4.230]) by shelob.surriel.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1m8yxv-00028o-7O for kernelnewbies@kernelnewbies.org; Thu, 29 Jul 2021 01:52:19 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id A7FAA5803F8; Thu, 29 Jul 2021 01:52:16 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Thu, 29 Jul 2021 01:52:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kroah.com; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm1; bh=viiBn1GywulERgvrKcCmkXUyuBc +hfV25KNyhlk4biE=; b=UvBUR3YSV1Hzv1rHB+81W9W34BIL1FI5U6cXTigUmL/ 46ODEIp8Kx7bAynesl+dIL6v0Q/iXqjtQjguo7w4zE3oFJmZrjaMWM35HTzcO+Hr PB9LgXc0v5rVc7Vvs7UYo8BoeeKpFqdtXJOiniOQOHV2q4uK65Dd90Rp/hyXsVaO ZyDgV36GQw673DE9qDtLLtPZZ+gJMflXvxKYAJigEGFJkHgyHSFn92Ytml0j/zxj WVaViCDv+ftKZZ9HBUnTjXcoSk24ubmoPSZDzxv8vDLFHX9MPuyTpsMn/CeooxP5 KvEmLHuOcRgK7S1kKNM28yfZfqkvPfXXHp2PoKabXew== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=viiBn1 GywulERgvrKcCmkXUyuBc+hfV25KNyhlk4biE=; b=ZPwAAszRN1awh/jGyBm78/ 7vUhL5y7FGte7hlzU3CkqzNtuO0eFM9XdbR3OnSo3skQrB3FCatPPsvmtLgHmCZd yo9+sZpuF/OqKytUSJu/nHwMn+5Y86MV+P0fSF+RJSh5E6ftRc/LKe9CdqcC6Ed8 +MSGjkmwFHprHRF/1eJDXgAK8vQA4ZyrR1zI9sM9LIJYj4ylG5EylMHuGTSa3sK2 OzRPmC4lfiLhN/OnsS/JkxAoo603S/yHPPHVCaeaIvYgsCZzIny3oHyvOh+xTDRc +Z7j9wEOzFp1Yj54n7mQXia+oHSUliWVY9gVFMvZriImJ6aB/VZ6pB13YMH6MCxg == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrhedtgdeltdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepfffhvffukfhfgggtuggjsehttdertd dttddvnecuhfhrohhmpefirhgvghcumffjuceoghhrvghgsehkrhhorghhrdgtohhmqeen ucggtffrrghtthgvrhhnpeevueehjefgfffgiedvudekvdektdelleelgefhleejieeuge egveeuuddukedvteenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhl fhhrohhmpehgrhgvgheskhhrohgrhhdrtghomh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 29 Jul 2021 01:52:15 -0400 (EDT) Date: Thu, 29 Jul 2021 07:52:11 +0200 From: Greg KH To: Ian Pilcher Subject: Re: [RFC PATCH 3/8] block: Add kernel APIs to create & delete block device LED triggers Message-ID: References: <20210729015344.3366750-1-arequipeno@gmail.com> <20210729015344.3366750-4-arequipeno@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210729015344.3366750-4-arequipeno@gmail.com> Cc: axboe@kernel.dk, kernelnewbies@kernelnewbies.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, pavel@ucw.cz, linux-leds@vger.kernel.org X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kernelnewbies-bounces@kernelnewbies.org On Wed, Jul 28, 2021 at 08:53:39PM -0500, Ian Pilcher wrote: > * New file - include/linux/blk-ledtrig.h > > Signed-off-by: Ian Pilcher > --- > block/blk-ledtrig.c | 152 ++++++++++++++++++++++++++++++++++++ > include/linux/blk-ledtrig.h | 19 +++++ > 2 files changed, 171 insertions(+) > create mode 100644 include/linux/blk-ledtrig.h > > diff --git a/block/blk-ledtrig.c b/block/blk-ledtrig.c > index 345a3b6bdbc6..c69ea1539336 100644 > --- a/block/blk-ledtrig.c > +++ b/block/blk-ledtrig.c > @@ -6,9 +6,11 @@ > * Copyright 2021 Ian Pilcher > */ > > +#include > #include > #include > #include > +#include > > > /* > @@ -49,3 +51,153 @@ static struct blk_ledtrig *blk_ledtrig_find(const char *const name, > > return NULL; > } > + > + > +/* > + * > + * Create a new trigger > + * > + */ > + > +static int __blk_ledtrig_create(const char *const name, const size_t len) > +{ > + struct blk_ledtrig *t; > + int ret; > + > + if (len == 0) { > + pr_warn("empty name specified for blockdev LED trigger\n"); > + ret = -EINVAL; > + goto create_exit_return; > + } > + > + ret = mutex_lock_interruptible(&blk_ledtrig_list_mutex); > + if (unlikely(ret != 0)) Only ever use likely/unlikely if you can measure the difference without it. Otherwise the CPU and compiler will almost always get it right and you should not clutter up the code with them at all. For something like this function, where there is no speed difference at all, there is no need for these types of markings, so I would recommend just removing them all from your patchset. thanks, greg k-h _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies