lkml.org 
[lkml]   [2022]   [Mar]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/3] random: replace custom notifier chain with standard one
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
> <linux@dominikbrodowski.net> 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

\
 
 \ /
  Last update: 2022-03-02 15:54    [W:0.050 / U:2.116 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site