Return-path: Received: from mail-ew0-f208.google.com ([209.85.219.208]:58465 "EHLO mail-ew0-f208.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751977AbZJRQ7Y (ORCPT ); Sun, 18 Oct 2009 12:59:24 -0400 From: Ivo van Doorn To: Bartlomiej Zolnierkiewicz Subject: Re: [PATCH 2/2] rt2x00: Implement support for rt2800pci Date: Sun, 18 Oct 2009 18:59:21 +0200 Cc: John Linville , linux-wireless@vger.kernel.org, users@rt2x00.serialmonkey.com, Alban Browaeys , Benoit PAPILLAULT , Felix Fietkau , Luis Correia , Mattias Nissler , Mark Asselstine , Xose Vazquez Perez , "linux-kernel" References: <200910152137.58164.IvDoorn@gmail.com> <200910152204.16407.IvDoorn@gmail.com> <200910171654.03344.bzolnier@gmail.com> In-Reply-To: <200910171654.03344.bzolnier@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Message-Id: <200910181859.22413.IvDoorn@gmail.com> Sender: linux-wireless-owner@vger.kernel.org List-ID: > I also used the opportunity to take a closer look at this driver and > it seems that it needlessly adds around 2 KLOC to kernel by duplicating > the common content of rt2800usb.h to rt2800pci.h instead of moving it > to the shared header (like it is done in the staging crap drivers): > > $ wc -l drivers/net/wireless/rt2x00/rt2800usb.h drivers/net/wireless/rt2x00/rt2800pci.h > 1951 drivers/net/wireless/rt2x00/rt2800usb.h > 1960 drivers/net/wireless/rt2x00/rt2800pci.h > 3911 total > > $ diff -u drivers/net/wireless/rt2x00/rt2800usb.h drivers/net/wireless/rt2x00/rt2800pci.h|diffstat > rt2800pci.h | 213 +++++++++++++++++++++++++++++++----------------------------- > 1 file changed, 111 insertions(+), 102 deletions(-) Creating rt2800.h with common register defines has been on the todo list for some time already, it will likely happen in the future, but until I get around to update my debugfs scripts the seperate rt2800pci.h and rt2800usb.h files make debugging and register analysis a bit easier. > Similarly it looks like most of the code between rt2800usb.c and rt2800pci.c > could also be shared (up to another 2 KLOC saved) by adding abstraction layer > for accessing chipset registers over different buses (again like it is done > in staging crap drivers): > > $ wc -l drivers/net/wireless/rt2x00/rt2800usb.c drivers/net/wireless/rt2x00/rt2800pci.c > 3077 drivers/net/wireless/rt2x00/rt2800usb.c > 3323 drivers/net/wireless/rt2x00/rt2800pci.c > 6400 total > > $ diff -u drivers/net/wireless/rt2x00/rt2800usb.c drivers/net/wireless/rt2x00/rt2800pci.c|diffstat > rt2800pci.c | 2190 +++++++++++++++++++++++++++++++++--------------------------- > 1 file changed, 1218 insertions(+), 972 deletions(-) I don't agree on this, for starters the whole "abstraction layer as done in the staging driver, really obfuscated the code in multiple areas, so whatever abstraction layer will be needed for rt2x00 it should be done much cleaner without the ugly defines and crap like that. So unless there is a _clean_ and very _readable_ solution for such abstraction layer I might consider it. Secondly, you can't merge them until both drivers would correctly for all users/chipsets, because only then you can see what registers are initialized equaly, and where potential pitfalls are between the 2 busses. > All in all, the total amount of the kernel code needed for implementing > rt2800pci functionality should 1-2 KLOC instead of the current 5 KLOC. Ivo