From patchwork Fri Nov 6 12:39:30 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 37844 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id A3D3FB70B3 for ; Fri, 6 Nov 2009 23:40:57 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758091AbZKFMks (ORCPT ); Fri, 6 Nov 2009 07:40:48 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758081AbZKFMks (ORCPT ); Fri, 6 Nov 2009 07:40:48 -0500 Received: from mail-ew0-f207.google.com ([209.85.219.207]:58044 "EHLO mail-ew0-f207.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758039AbZKFMkq (ORCPT ); Fri, 6 Nov 2009 07:40:46 -0500 Received: by mail-ew0-f207.google.com with SMTP id 3so975605ewy.37 for ; Fri, 06 Nov 2009 04:40:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=N6h+yQV4jUl49LYyJnDSi+RnrXp6qO6HHRP1dayYw4o=; b=IIcrikWoitMcYOo3XLvmKvpgFFnYEtQ7X6faziifAIkMvW74P7oI6zSj1k9NqdZ6r5 RNy/xjPWR8LlNRhN+QZWVLO5arV2tM2UGann8lghGGg4pS/kN4ZfD3FrSRQeC9X+6eCI jhUAL0eLZzOR4gu47HcE8VQPwTyNkCnOEYwmc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=KSidPHicTbZWZjEE2818qj5jcmQOxW9JoJeRJY+y94JK+2TtZcgw3wzxP6KL0Hv8AE Lm1ZRVFZ86giRPt5oQfCGz8T9BGmUtPuak+MjJ1hpiGdwTUJN0LGOyLtGwtZa7LcjGby MJTHuB0/mcKJ7yYzAZaNInsoP5M7yUB/pb6NI= Received: by 10.213.50.139 with SMTP id z11mr4959520ebf.36.1257511251542; Fri, 06 Nov 2009 04:40:51 -0800 (PST) Received: from localhost.localdomain ([91.213.169.4]) by mx.google.com with ESMTPS id 28sm345811eyg.30.2009.11.06.04.40.49 (version=SSLv3 cipher=RC4-MD5); Fri, 06 Nov 2009 04:40:50 -0800 (PST) From: Dmitry Eremin-Solenikov To: "David S. Miller" Cc: netdev@vger.kernel.org, Sergey Lapin Subject: [PATCH 06/17] wpan-phy: follow usual patter of devices registration Date: Fri, 6 Nov 2009 15:39:30 +0300 Message-Id: <1257511181-19403-7-git-send-email-dbaryshkov@gmail.com> X-Mailer: git-send-email 1.6.5 In-Reply-To: <1257511181-19403-1-git-send-email-dbaryshkov@gmail.com> References: <1257511181-19403-1-git-send-email-dbaryshkov@gmail.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Follow the usual pattern of devices registration by adding new function (wpan_phy_set_dev) that sets child->parent relationship and removing parent argument from wpan_phy_register call. Signed-off-by: Dmitry Eremin-Solenikov --- drivers/ieee802154/fakehard.c | 3 ++- include/net/wpan-phy.h | 6 +++++- net/ieee802154/wpan-class.c | 4 +--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/ieee802154/fakehard.c b/drivers/ieee802154/fakehard.c index f6f2afe..4ea93cc 100644 --- a/drivers/ieee802154/fakehard.c +++ b/drivers/ieee802154/fakehard.c @@ -372,11 +372,12 @@ static int __devinit ieee802154fake_probe(struct platform_device *pdev) goto out; } + wpan_phy_set_dev(phy, &pdev->dev); SET_NETDEV_DEV(dev, &phy->dev); platform_set_drvdata(pdev, dev); - err = wpan_phy_register(&pdev->dev, phy); + err = wpan_phy_register(phy); if (err) goto out; diff --git a/include/net/wpan-phy.h b/include/net/wpan-phy.h index 7b7fc58..f63537c 100644 --- a/include/net/wpan-phy.h +++ b/include/net/wpan-phy.h @@ -45,7 +45,11 @@ struct wpan_phy { }; struct wpan_phy *wpan_phy_alloc(size_t priv_size); -int wpan_phy_register(struct device *parent, struct wpan_phy *phy); +static inline void wpan_phy_set_dev(struct wpan_phy *phy, struct device *dev) +{ + phy->dev.parent = dev; +} +int wpan_phy_register(struct wpan_phy *phy); void wpan_phy_unregister(struct wpan_phy *phy); void wpan_phy_free(struct wpan_phy *phy); /* Same semantics as for class_for_each_device */ diff --git a/net/ieee802154/wpan-class.c b/net/ieee802154/wpan-class.c index 0c51f85..cd42e88 100644 --- a/net/ieee802154/wpan-class.c +++ b/net/ieee802154/wpan-class.c @@ -168,10 +168,8 @@ struct wpan_phy *wpan_phy_alloc(size_t priv_size) } EXPORT_SYMBOL(wpan_phy_alloc); -int wpan_phy_register(struct device *parent, struct wpan_phy *phy) +int wpan_phy_register(struct wpan_phy *phy) { - phy->dev.parent = parent; - return device_add(&phy->dev); } EXPORT_SYMBOL(wpan_phy_register);