From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932763AbcITJtu (ORCPT ); Tue, 20 Sep 2016 05:49:50 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:58579 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932616AbcITJtr (ORCPT ); Tue, 20 Sep 2016 05:49:47 -0400 Date: Tue, 20 Sep 2016 11:47:16 +0200 (CEST) From: Thomas Gleixner To: Matt Redfearn cc: Ralf Baechle , Bjorn Andersson , Ohad Ben-Cohen , linux-mips@linux-mips.org, linux-remoteproc@vger.kernel.org, lisa.parratt@imgtec.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 5/6] remoteproc/MIPS: Add a remoteproc driver for MIPS In-Reply-To: <1474361249-31064-6-git-send-email-matt.redfearn@imgtec.com> Message-ID: References: <1474361249-31064-1-git-send-email-matt.redfearn@imgtec.com> <1474361249-31064-6-git-send-email-matt.redfearn@imgtec.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 20 Sep 2016, Matt Redfearn wrote: > +/* Intercept CPU hotplug events for syfs purposes */ > +static int mips_rproc_callback(struct notifier_block *nfb, unsigned long action, > + void *hcpu) > +{ Please convert to cpu hotplug state machine. > + unsigned int cpu = (unsigned long)hcpu; > + > + switch (action) { > + case CPU_UP_PREPARE: > + case CPU_DOWN_FAILED: > + mips_rproc_device_unregister(cpu); > + break; > + case CPU_DOWN_PREPARE: > + mips_rproc_device_register(cpu); > + break; > + } There is no reason why you need to setup the rproc device on DOWN_PREPARE. It's sufficient to do that when the CPU is dead, so you can use a symetric callback prep/dead. > + /* Dynamically create mips-rproc class devices based on hotplug data */ > + get_online_cpus(); > + for_each_possible_cpu(cpu) > + if (!cpu_online(cpu)) > + mips_rproc_device_register(cpu); > + register_hotcpu_notifier(&mips_rproc_notifier); > + put_online_cpus(); Perhaps we should add support for "reverse" functionality to the state machine core. I'll have a look later how hard that'd be. Thanks, tglx