From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C2303B6FB3 for ; Tue, 24 May 2011 01:49:28 +1000 (EST) In-Reply-To: <1306059295-25806-2-git-send-email-dbaryshkov@gmail.com> References: <1306059295-25806-1-git-send-email-dbaryshkov@gmail.com> <1306059295-25806-2-git-send-email-dbaryshkov@gmail.com> Mime-Version: 1.0 (Apple Message framework v624) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: From: Segher Boessenkool Subject: Re: [PATCH V2 2/2] cpc925_edac: support single-processor configurations Date: Mon, 23 May 2011 17:50:59 +0200 To: Dmitry Eremin-Solenikov Cc: Harry Ciao , linuxppc-dev@lists.ozlabs.org, Paul Mackerras , Doug Thompson List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , > If second CPU is not enabled, CPC925 EDAC driver will spill out > warnings > about errors on second Processor Interface. Support masking that out, > by detecting at runtime which CPUs are present in device tree. > > Signed-off-by: Dmitry Eremin-Solenikov > Cc: Harry Ciao > Cc: Doug Thompson > Signed-off-by: Dmitry Eremin-Solenikov Acked-by: Segher Boessenkool Minor stuff... > + /* Get first CPU node */ Comment doesn't match code. > + for (cpunode = NULL; > + (cpunode = of_get_next_child(cpus, cpunode)) != NULL;) { Use a while loop instead? > + const u32 *reg = of_get_property(cpunode, "reg", NULL); > + > + if (!strcmp(cpunode->type, "cpu") && reg != NULL) > + mask &= ~APIMASK_ADI(*reg); > + } You might want to check if the "reg" value is < 2, you get C undefined behaviour if it is too big (not that that should happen), and it's clearer code anyway. > + cpumask = cpc925_cpu_getmask(); You could choose a function name that makes more clear these are the processor _interfaces_ that are _not_ used :-) You could cache this value as well. Segher