how to go forward?

Holger Schurig hs4233 at mail.mn-solutions.de
Fri Feb 16 11:23:01 EST 2007


All my little patches helped me to learn the source code
better. However, the big thing (actually separating
hardware independend and hardware dependend stuff)
hasn't been done.

The USB dongle I received currently behaves exactly
the same with the plain and with the following patches:

  no-file-in-debug.patch
  fix-debugfs.patch
  remove-unused-var.patch
  fix-printk-newline.patch
  remove-libertas-sbi-get-priv.patch
  remove-static-wlanpriv.patch
  make-mesh-configurable.patch

http://projects.linuxtogo.org/plugins/scmsvn/viewcvs.php/trunk/patches/?root=marvell8385



However, I'm nearing a state where my patches get more
intrusive and bigger. I'm not really sure on how to
proceed. Basically, I want to move things from main.c
into if_usb.c that are usb-related. That means
splitting wlan_add_card() into more function.

Currently I'm thinking on the line to have a basic
libertas_add_card() in main.c which get's a void* cardp.
It would alloc_etherdev(), kmalloc wlan_private *priv
(hmm, why not kzalloc?), and basically do all the things
that are not inside #ifdef CONFIG_LIBERTAS_MESH after my
patch "make-mesh-configurable.patch".

In if_usb_probe() we currently call wlan_add_card(). That
would be changed to libertas_add_card(). If that succeeded,
we'd would call a static if_usb_add_card() which would do
all the mesh_dev things.

It could even re-route some of the dev->XXXX function
pointers set in libertas_add_card() to local copies.
Example: main.c's libertas_add_card() would do

  dev->set_mac_address = libertas_set_mac_address

if_usb.c's if_usb_probe() would call if_usb_add_card(), which
in turn would override this:

  priv->wlan_dev.netdev->set_mac_address = if_usb_sef_mac_address

And in if_usb_mac_address() we'd do something like this:

  static int if_usb_set_mac_address(struct net_device *dev,
                                    void *addr)
  {
      wlan_private *priv = dev->priv;
      int ret = libertas(set_mac_address(dev, addr);
      if (ret==0) {
           memcpy(priv->mesh_dev->dev_addr, 
                 (struct sockaddr *) addr, ETH_ALEN);
      }
      return ret;
  }


Would that architecture be acceptable?



More information about the libertas-dev mailing list