Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754688Ab1CPVNG (ORCPT ); Wed, 16 Mar 2011 17:13:06 -0400 Received: from kroah.org ([198.145.64.141]:42613 "EHLO coco.kroah.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752851Ab1CPVLs (ORCPT ); Wed, 16 Mar 2011 17:11:48 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Ferenc Wagner , Greg Kroah-Hartman Subject: [PATCH 18/50] driver core: Replace the dangerous to_root_device macro with an inline function Date: Wed, 16 Mar 2011 14:10:56 -0700 Message-Id: <1300309888-5028-18-git-send-email-gregkh@suse.de> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1300309888-5028-1-git-send-email-gregkh@suse.de> References: <20110316205204.GA2686@kroah.com> <1300309888-5028-1-git-send-email-gregkh@suse.de> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1145 Lines: 36 From: Ferenc Wagner The original macro worked only when applied to variables named 'dev'. While this could have been fixed by simply renaming the macro argument, a more type-safe replacement by an inline function is preferred. Signed-off-by: Ferenc Wagner Signed-off-by: Greg Kroah-Hartman --- drivers/base/core.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index 9cd3b5c..81b78ed 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -1320,7 +1320,10 @@ struct root_device struct module *owner; }; -#define to_root_device(dev) container_of(dev, struct root_device, dev) +inline struct root_device *to_root_device(struct device *d) +{ + return container_of(d, struct root_device, dev); +} static void root_device_release(struct device *dev) { -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/