From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lars-Peter Clausen Subject: Re: [PATCH v3 02/10] spmi: Linux driver framework for SPMI Date: Tue, 29 Oct 2013 20:18:03 +0100 Message-ID: <527009EB.3010704@metafoo.de> References: <149bbfe89e37376cc176c3aeb6c1fab9e4fd2b91.1382985169.git.joshc@codeaurora.org> <526FD278.8080102@metafoo.de> <20131029155616.GG20207@joshc.qualcomm.com> <526FE2B6.8050701@codeaurora.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Return-path: Received: from smtp-out-046.synserver.de ([212.40.185.46]:1052 "EHLO smtp-out-046.synserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751307Ab3J2TSG (ORCPT ); Tue, 29 Oct 2013 15:18:06 -0400 In-Reply-To: <526FE2B6.8050701@codeaurora.org> Sender: linux-arm-msm-owner@vger.kernel.org List-Id: linux-arm-msm@vger.kernel.org To: Stephen Boyd Cc: Josh Cartwright , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Sagar Dharia , Gilad Avidov , Michael Bohan , "Ivan T. Ivanov" On 10/29/2013 05:30 PM, Stephen Boyd wrote: > On 10/29/13 08:56, Josh Cartwright wrote: >> >>>> +#define to_spmi_controller(d) container_of(d, struct spmi_controller, dev) >>> Should be a inline function for better type safety. >> Sounds good. Will change the to_spmi_*() macros. > > I was under the impression that container_of() already does type > checking. At least it will ensure that typeof(d) == typeof(dev) in the > above example which is about as good as it can get. Well you'll get a warning, but the quality of the warning message is much better when an inline function is used. warning: initialization from incompatible pointer type vs. warning: Passing argument 1 of to_smpi_controller() from incompatible pointer type. Expected struct device * got struct driver * - Lars