From patchwork Wed Nov 4 17:35:00 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 57692 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nA4Hf3uL014081 for ; Wed, 4 Nov 2009 17:41:04 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932325AbZKDRf1 (ORCPT ); Wed, 4 Nov 2009 12:35:27 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932256AbZKDRf0 (ORCPT ); Wed, 4 Nov 2009 12:35:26 -0500 Received: from fg-out-1718.google.com ([72.14.220.157]:5665 "EHLO fg-out-1718.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932169AbZKDRfT (ORCPT ); Wed, 4 Nov 2009 12:35:19 -0500 Received: by fg-out-1718.google.com with SMTP id 16so386425fgg.1 for ; Wed, 04 Nov 2009 09:35:24 -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:date:message-id :in-reply-to:references:subject; bh=vJQtAyDYcwyRSX7HdTLxZs2hD9j/BIyrNNB9aLkeg8A=; b=EQrGZM4Y4H2PCuwhuU3NZdA34L+9oYOfyGamd4Sct47jm/wrWUcZCasLV8XxwGEV8J FArUE5k87GKlAMU+THy0auAGOTfAVqHvT3bmc/lO9jYcfsLxYf+SHhHl16Tyv2aV8u9Y XcY6znseRkpMG9nrQwwY6iFo80/0mAync3jew= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:date:message-id:in-reply-to:references:subject; b=mN5wVH46yGCmMb+3oWr2LYnfa7LvGgzp7JP83d/O82K3cmSHpVaJhufVDALsRFVGpN hIQMVZI22OgGYdMAYebm8BKoDl2Nl+45Jr+YibmyaW/GvVz3QVt9Y4TlTi8TE6jpMGZx 21v0qqpANcJwKl6LZRFGpSbSg9LuKVhFf0tsU= Received: by 10.86.119.39 with SMTP id r39mr4119825fgc.50.1257356124380; Wed, 04 Nov 2009 09:35:24 -0800 (PST) Received: from localhost.localdomain (chello089079027028.chello.pl [89.79.27.28]) by mx.google.com with ESMTPS id d6sm675471fga.10.2009.11.04.09.35.23 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 04 Nov 2009 09:35:23 -0800 (PST) From: Bartlomiej Zolnierkiewicz To: linux-wireless@vger.kernel.org Cc: Ivo van Doorn , Bartlomiej Zolnierkiewicz , Gertjan van Wingerde , linux-kernel@vger.kernel.org, "John W. Linville" Date: Wed, 04 Nov 2009 18:35:00 +0100 Message-Id: <20091104173500.28463.89800.sendpatchset@localhost.localdomain> In-Reply-To: <20091104173151.28463.68742.sendpatchset@localhost.localdomain> References: <20091104173151.28463.68742.sendpatchset@localhost.localdomain> Subject: [PATCH 25/41] rt2800pci: convert to use struct rt2800_ops methods Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Index: b/drivers/net/wireless/rt2x00/rt2800pci.c =================================================================== --- a/drivers/net/wireless/rt2x00/rt2800pci.c +++ b/drivers/net/wireless/rt2x00/rt2800pci.c @@ -2988,10 +2988,23 @@ static int rt2800pci_probe_hw_mode(struc return 0; } +static const struct rt2800_ops rt2800pci_rt2800_ops = { + .register_read = rt2x00pci_register_read, + .register_write = rt2x00pci_register_write, + .register_write_lock = rt2x00pci_register_write, /* same for PCI */ + + .register_multiread = rt2x00pci_register_multiread, + .register_multiwrite = rt2x00pci_register_multiwrite, + + .regbusy_read = rt2x00pci_regbusy_read, +}; + static int rt2800pci_probe_hw(struct rt2x00_dev *rt2x00dev) { int retval; + rt2x00dev->priv = (void *)&rt2800pci_rt2800_ops; + /* * Allocate eeprom data. */ Index: b/drivers/net/wireless/rt2x00/rt2800pci.h =================================================================== --- a/drivers/net/wireless/rt2x00/rt2800pci.h +++ b/drivers/net/wireless/rt2x00/rt2800pci.h @@ -27,32 +27,60 @@ #ifndef RT2800PCI_H #define RT2800PCI_H +struct rt2800_ops { + void (*register_read)(struct rt2x00_dev *rt2x00dev, + const unsigned int offset, u32 *value); + void (*register_write)(struct rt2x00_dev *rt2x00dev, + const unsigned int offset, u32 value); + void (*register_write_lock)(struct rt2x00_dev *rt2x00dev, + const unsigned int offset, u32 value); + + void (*register_multiread)(struct rt2x00_dev *rt2x00dev, + const unsigned int offset, + void *value, const u16 length); + void (*register_multiwrite)(struct rt2x00_dev *rt2x00dev, + const unsigned int offset, + const void *value, const u16 length); + + int (*regbusy_read)(struct rt2x00_dev *rt2x00dev, + const unsigned int offset, + const struct rt2x00_field32 field, u32 *reg); +}; + static inline void rt2800_register_read(struct rt2x00_dev *rt2x00dev, const unsigned int offset, u32 *value) { - rt2x00pci_register_read(rt2x00dev, offset, value); + const struct rt2800_ops *rt2800ops = rt2x00dev->priv; + + rt2800ops->register_read(rt2x00dev, offset, value); } static inline void rt2800_register_write(struct rt2x00_dev *rt2x00dev, const unsigned int offset, u32 value) { - rt2x00pci_register_write(rt2x00dev, offset, value); + const struct rt2800_ops *rt2800ops = rt2x00dev->priv; + + rt2800ops->register_write(rt2x00dev, offset, value); } static inline void rt2800_register_write_lock(struct rt2x00_dev *rt2x00dev, const unsigned int offset, u32 value) { - rt2x00pci_register_write(rt2x00dev, offset, value); + const struct rt2800_ops *rt2800ops = rt2x00dev->priv; + + rt2800ops->register_write_lock(rt2x00dev, offset, value); } static inline void rt2800_register_multiread(struct rt2x00_dev *rt2x00dev, const unsigned int offset, void *value, const u16 length) { - rt2x00pci_register_multiread(rt2x00dev, offset, value, length); + const struct rt2800_ops *rt2800ops = rt2x00dev->priv; + + rt2800ops->register_multiread(rt2x00dev, offset, value, length); } static inline void rt2800_register_multiwrite(struct rt2x00_dev *rt2x00dev, @@ -60,7 +88,9 @@ static inline void rt2800_register_multi const void *value, const u16 length) { - rt2x00pci_register_multiwrite(rt2x00dev, offset, value, length); + const struct rt2800_ops *rt2800ops = rt2x00dev->priv; + + rt2800ops->register_multiwrite(rt2x00dev, offset, value, length); } static inline int rt2800_regbusy_read(struct rt2x00_dev *rt2x00dev, @@ -68,7 +98,9 @@ static inline int rt2800_regbusy_read(st const struct rt2x00_field32 field, u32 *reg) { - return rt2x00pci_regbusy_read(rt2x00dev, offset, field, reg); + const struct rt2800_ops *rt2800ops = rt2x00dev->priv; + + return rt2800ops->regbusy_read(rt2x00dev, offset, field, reg); } /*