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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 985F8C433FE for ; Wed, 2 Mar 2022 14:54:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243280AbiCBOyx (ORCPT ); Wed, 2 Mar 2022 09:54:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234237AbiCBOyt (ORCPT ); Wed, 2 Mar 2022 09:54:49 -0500 Received: from isilmar-4.linta.de (isilmar-4.linta.de [136.243.71.142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D946239830; Wed, 2 Mar 2022 06:54:05 -0800 (PST) X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES X-isilmar-external: YES Received: from owl.dominikbrodowski.net (owl.brodo.linta [10.2.0.111]) by isilmar-4.linta.de (Postfix) with ESMTPSA id 5F43D2013AD; Wed, 2 Mar 2022 14:54:03 +0000 (UTC) Received: by owl.dominikbrodowski.net (Postfix, from userid 1000) id D55E58084F; Wed, 2 Mar 2022 15:53:18 +0100 (CET) Date: Wed, 2 Mar 2022 15:53:18 +0100 From: Dominik Brodowski To: "Jason A. Donenfeld" Cc: LKML , Linux Crypto Mailing List , Netdev , Alexander Graf , Jann Horn , Greg KH , Theodore Ts'o Subject: Re: [PATCH 1/3] random: replace custom notifier chain with standard one Message-ID: References: <20220301231038.530897-1-Jason@zx2c4.com> <20220301231038.530897-2-Jason@zx2c4.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jason, Am Wed, Mar 02, 2022 at 12:42:56PM +0100 schrieb Jason A. Donenfeld: > On Wed, Mar 2, 2022 at 6:35 AM Dominik Brodowski > wrote: > > > > Am Wed, Mar 02, 2022 at 12:10:36AM +0100 schrieb Jason A. Donenfeld: > > > /* > > > * Delete a previously registered readiness callback function. > > > */ > > > -void del_random_ready_callback(struct random_ready_callback *rdy) > > > +int unregister_random_ready_notifier(struct notifier_block *nb) > > > { > > > unsigned long flags; > > > - struct module *owner = NULL; > > > - > > > - spin_lock_irqsave(&random_ready_list_lock, flags); > > > - if (!list_empty(&rdy->list)) { > > > - list_del_init(&rdy->list); > > > - owner = rdy->owner; > > > - } > > > - spin_unlock_irqrestore(&random_ready_list_lock, flags); > > > + int ret; > > > > > > - module_put(owner); > > > + spin_lock_irqsave(&random_ready_chain_lock, flags); > > > + ret = raw_notifier_chain_unregister(&random_ready_chain, nb); > > > + spin_unlock_irqrestore(&random_ready_chain_lock, flags); > > > + return ret; > > > } > > > -EXPORT_SYMBOL(del_random_ready_callback); > > > > That doesn't seem to be used anywhere, so I'd suggest removing this function > > altogether. > > I thought about this, but it feels weird to have a registration > function without an unregistration function... No other notifier is > unbalanced like that. ... but having unused code compiled in (unless LTO is enabled, of course) seems worse. Maybe comment it out, #ifdef COMPILE_TEST or something like that? Thanks, Dominik