public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Nokia c110 driver
@ 2004-02-28 12:23 Kliment Yanev
  2004-02-28 18:41 ` Randy.Dunlap
  0 siblings, 1 reply; 16+ messages in thread
From: Kliment Yanev @ 2004-02-28 12:23 UTC (permalink / raw)
  To: linux-kernel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I was attempting to compile the nokia c110 linux driver, meant for 2.4
kernels, on 2.6.3. Unsurprisingly, it gave me some errors. I suspect
that the modification to the source would not be too difficult, it just
seems to use some deprecated functions. I would be very willing to fix
it myself, however, I am not familiar with the kernel code at all. Here
are the errors the compile gives. Do you think you could point me in the
right direction? Below is the source of the file causing the errors as well.

gcc output starts here:

set -e; for d in src dctl; do make -C $d ; done
make[1]: Entering directory `/home/kliment/Desktop/nokia_c110/src'
gcc -O2 -Wall -Wstrict-prototypes -fomit-frame-pointer -pipe
- -D__KERNEL__ -DMODULE -I../include -I/usr/src/linux/include     -c  dllc.c
In file included from /usr/src/linux/include/asm/processor.h:18,
~                 from /usr/src/linux/include/asm/thread_info.h:13,
~                 from /usr/src/linux/include/linux/thread_info.h:21,
~                 from /usr/src/linux/include/linux/spinlock.h:12,
~                 from /usr/src/linux/include/linux/capability.h:45,
~                 from /usr/src/linux/include/linux/sched.h:7,
~                 from /usr/src/linux/include/linux/module.h:10,
~                 from nokia_info.h:42,
~                 from dllc.c:29:
/usr/src/linux/include/asm/system.h: In function `__set_64bit_var':
/usr/src/linux/include/asm/system.h:193: warning: dereferencing
type-punned pointer will break strict-aliasing rules
/usr/src/linux/include/asm/system.h:193: warning: dereferencing
type-punned pointer will break strict-aliasing rules
In file included from /usr/src/linux/include/linux/irq.h:20,
~                 from /usr/src/linux/include/asm/hardirq.h:6,
~                 from /usr/src/linux/include/linux/interrupt.h:11,
~                 from nokia_info.h:52,
~                 from dllc.c:29:
/usr/src/linux/include/asm/irq.h:16:25: irq_vectors.h: No such file or
directory
In file included from /usr/src/linux/include/asm/hardirq.h:6,
~                 from /usr/src/linux/include/linux/interrupt.h:11,
~                 from nokia_info.h:52,
~                 from dllc.c:29:
/usr/src/linux/include/linux/irq.h: At top level:
/usr/src/linux/include/linux/irq.h:70: error: `NR_IRQS' undeclared here
(not in a function)
In file included from /usr/src/linux/include/linux/irq.h:72,
~                 from /usr/src/linux/include/asm/hardirq.h:6,
~                 from /usr/src/linux/include/linux/interrupt.h:11,
~                 from nokia_info.h:52,
~                 from dllc.c:29:
/usr/src/linux/include/asm/hw_irq.h:28: error: `NR_IRQ_VECTORS'
undeclared here (not in a function)
/usr/src/linux/include/asm/hw_irq.h:31: error: `NR_IRQS' undeclared here
(not in a function)
In file included from nokia_info.h:89,
~                 from dllc.c:29:
nokia_priv.h:43:1: warning: "HZ" redefined
In file included from /usr/src/linux/include/linux/sched.h:4,
~                 from /usr/src/linux/include/linux/module.h:10,
~                 from nokia_info.h:42,
~                 from dllc.c:29:
/usr/src/linux/include/asm/param.h:5:1: warning: this is the location of
the previous definition
dllc.c: In function `dllc_devopen':
dllc.c:156: warning: `MOD_INC_USE_COUNT' is deprecated (declared at
/usr/src/linux/include/linux/module.h:488)
dllc.c: In function `dllc_devstop':
dllc.c:169: warning: `MOD_DEC_USE_COUNT' is deprecated (declared at
/usr/src/linux/include/linux/module.h:500)
make[1]: *** [dllc.o] Error 1
make[1]: Leaving directory `/home/kliment/Desktop/nokia_c110/src'
make: *** [all] Error 2

gcc errors end here
dllc.c starts here:

/***************************************************************************
~ * The contents of this file are subject to the NOKOS License Version 1.0
~ * (the "License"); you may not use this file except in compliance with the
~ * License.
~ *
~ * Software distributed under the License is distributed on an "AS IS"
basis,
~ * WITHOUT WARRANTY OF  ANY KIND, either express or implied. See the
License
~ * for the specific language governing rights and limitations under the
~ * License.
~ *
~ * The Original Software is Nokia C110/C111 for Linux.
~ *
~ * Copyright (c) Nokia Mobile Phones 2001 and others. All Rights Reserved.
~ *
~ * Nokia is a registered trademark of Nokia Corporation.
~ * Other product and company names mentioned herein may be
~ * trademarks or tradenames of their respective owners.
~ *
~ * Contributor(s): ______________________________________.
~ *
~
**************************************************************************/

/***************************************************************************
~ *
~ * Define Linux netdevice above MAC
~ *
~
**************************************************************************/

#include "nokia_info.h"

/* Static functions' declarations */
static int dllc_devinit (device_t *dev );
static int dllc_devopen (device_t *dev );
static int dllc_devstop (device_t *dev );
static int dllc_devhard_start_xmit (struct sk_buff *skb , device_t *dev );
static struct net_device_stats * dllc_devgetstats (device_t *dev );
static void dllc_devset_multicast_list (device_t *dev );
static int dllc_devdo_ioctl (device_t *dev , void *req , int cmd );
static INT dllc_put_to_queue (dllc_t *dllc, struct sk_buff *skb);
static struct sk_buff *dllc_get_from_queue (dllc_t *dllc);
static struct sk_buff *dllc_remove_from_queue (dllc_t *dllc);
static INT dllc_init_queue(dllc_t *dllc);
static void dllc_close_queue(dllc_t *dllc);
static void dllc_timer (unsigned long dllc);

#define QUEUE_SIZE  10 /* skb queue size */
#define QUEUE_MAX    7 /* when to tell kernel to stop sending */
#define QUEUE_LOW    5 /* when to tell kernel to start again sending */

spinlock_t tx_lock=SPIN_LOCK_UNLOCKED;

dllc_t *dllc_new(driver_priv_t *priv)
{
~        dllc_t *dllc;

~        if(!priv) return NULL;

~        dllc = kmalloc(sizeof(dllc_t), GFP_KERNEL);
~        if(!dllc) goto dllc_new_fail;
~        memset(dllc,0,sizeof(dllc_t));

~        if (dllc_init_queue(dllc) == FALSE)
~                goto dllc_new_fail;

~        /* initialize timer */
~        dllc->timer.data = (unsigned long) dllc;
~        dllc->timer.function = dllc_timer;
~        init_timer(&dllc->timer);

~        /* TX packets in buffers */
~        dllc->tx_packets_in_queue = 0;
~        dllc->tx_packets_dropped = 0;
~        dllc->netif_stopped = 0;

~        /* You have llc. Now make the netdevice */

~        dllc->dev = kmalloc(sizeof(device_t), GFP_KERNEL);
~        if(!dllc->dev) goto dllc_new_fail;
~        memset(dllc->dev, 0, sizeof(device_t));

~        /* Link it all together */

~        dllc->priv = priv;
~        dllc->dev->priv = dllc;

~        /* callback pointers */

~        dllc->dev->init = dllc_devinit;
~        dllc->dev->open = dllc_devopen;
~        dllc->dev->stop = dllc_devstop;
~        dllc->dev->hard_start_xmit = dllc_devhard_start_xmit;
~        dllc->dev->get_stats = dllc_devgetstats;
~        dllc->dev->set_multicast_list = dllc_devset_multicast_list;
~        dllc->dev->do_ioctl	= (void *)dllc_devdo_ioctl;

~        return dllc;

~  dllc_new_fail:

~        if(dllc) {
~                dllc_delete(dllc);
~        }
~        return NULL;
}

int dllc_register (dllc_t *dllc){

~        if (!dllc) return -1;

~        ether_setup(dllc->dev);

~        if(register_netdev(dllc->dev)) {
~                ERROR("Failed to register netdev.\n");
~                return -1;
~        }
~        DEBUG("Registered netdev '%s'.\n",dllc->dev->name);

~        return 0;
}

void dllc_delete(dllc_t *dllc)
{
~        if(!dllc) return;

~        DEBUG("dllc delete\n");

~        /* delete timer */
~        del_timer_sync (&dllc->timer);

~        if (dllc->dev) {
~                unregister_netdev(dllc->dev);
~                dfree(dllc->dev,sizeof(device_t));
~                dllc->dev = NULL;
~        }

~        dllc_close_queue (dllc);
~        dfree(dllc, sizeof(dllc_t));
}

/* Called by register_netdev */

static int dllc_devinit(device_t *dev)
{
~        return 0;
}

/* Called when ifconfig sets it up */

static int dllc_devopen(device_t *dev)
{
~        if (!dev) return -1;
~        /* set the flags in the device object */

~        netif_start_queue(dev);

~        MOD_INC_USE_COUNT;

~        return 0;
}

/* Called when ifconfig closes it */

static int dllc_devstop(device_t *dev)
{
~        if (!dev) return -1;

~        netif_stop_queue(dev);

~        MOD_DEC_USE_COUNT;

~        return 0;
}


/* Called when we get packet from the OS */

static int dllc_devhard_start_xmit(struct sk_buff *skb, device_t *dev)
{
~        dllc_t *llc;
~        INT result = FALSE;
~        UINT32 ref = 0;

~        if (!dev) return -1;
~        if (!skb) return -1;

~        llc = dev->priv;
~        if(!llc)
~                return 0;

~        if(!llc->priv || !llc->priv->mgr)
~                return 0;

~        if (!netif_running(dev))
~                return 0;

~        spin_lock_bh(&tx_lock);

~        dev->trans_start = jiffies;
~        if (llc->tx_packets_in_queue == 0) // send immediately if queue
if empty
~                result = dmgr_tx_frame( llc->priv->mgr,
~                                        &skb->data[0] ,   // dest
~                                        &skb->data[6] ,   // src
~                                        dt_get16(&skb->data[12]),   // type
~                                        &skb->data[14],   // data
~                                        ref,            //reference;
~                                        (skb->len - 14));   // length
~        if (result == TRUE) //free skb if packet was sent
~                dev_kfree_skb(skb);
~        else {
~                /* Put packet to queue */
~                if ( dllc_put_to_queue (llc, skb) == FALSE ){
~                        ERROR ("Packet queueing failed, dropping
packet....\n");
~                        dev_kfree_skb(skb); //can't buffer packet, free skb
~                        llc->stats.tx_errors++;
~                        llc->tx_packets_dropped++;
~                }
~                else {
~                        /* increment packet counter */
~                        llc->tx_packets_in_queue++;
~                        if ( (llc->tx_packets_in_queue > QUEUE_MAX) &&
(llc->netif_stopped == 0) ){
~                                netif_stop_queue (dev);
~                                llc->netif_stopped = 1;
~                        }
~                        mod_timer(&llc->timer, jiffies);
~                }
~        }

~        spin_unlock_bh(&tx_lock);

~        return 0;
}

#define MAX_RETRIES 5
#define MIN_TIMEOUT HZ/50

static void dllc_timer (unsigned long dllc_struct){
~        dllc_t *llc = (dllc_t*) dllc_struct;
~        struct sk_buff *skb;
~        INT result = 0;
~        UINT32 ref = 0;
~        INT count = 0;
~        UINT32 timeout;
~        static INT32 errors = 0;

~        spin_lock_bh(&tx_lock);
~        while ( (skb = dllc_get_from_queue (llc)) ) {
~                count++;
~                result = dmgr_tx_frame( llc->priv->mgr,
~                                        &skb->data[0] ,   // dest
~                                        &skb->data[6] ,   // src
~                                        dt_get16(&skb->data[12]),   // type
~                                        &skb->data[14],   // data
~                                        ref,            //reference;
~                                        (skb->len - 14));   // length
~                if (result == TRUE){
~                        errors = 0;
~                        /* remove from queue and free skb */
~                        skb = dllc_remove_from_queue (llc);
~                        llc->tx_packets_in_queue--;
~                        dev_kfree_skb(skb);
~                        if (!llc->tx_packets_in_queue &&
llc->netif_stopped){
~                                netif_wake_queue(llc->dev);
~                                llc->netif_stopped = 0;
~                        }
~                }
~                else {
~                        if (!llc->netif_stopped){ // stop the netif if
error in sending
~                                netif_stop_queue (llc->dev);
~                                llc->netif_stopped = 1;
~                        }

~                        timeout = (errors > 0) ? (MIN_TIMEOUT * errors)
: MIN_TIMEOUT;
~                        if (errors > MAX_RETRIES){
~                                errors = 0;
~                                skb = dllc_remove_from_queue (llc);
~                                llc->tx_packets_in_queue--;
~                                dev_kfree_skb(skb);
~                                llc->stats.tx_errors++;
~                                llc->tx_packets_dropped++;
~                        }
~                        else {
~                                errors++;
~                        }
~                        mod_timer(&llc->timer, jiffies + timeout);
~                        break;
~                }
~        }

~        if (count == 0){
~                DEBUG ("No data to send\n");
~                if (!llc->tx_packets_in_queue &&  llc->netif_stopped){
~                        netif_wake_queue(llc->dev);
~                        llc->netif_stopped = 0;
~                }
~        }

~        spin_unlock_bh(&tx_lock);

~        return ;
}

/* Called when tx completes to radio, should update stats */

void dllc_ontxcomplete( driver_priv_t *priv, UINT32 ref, UINT32 txresult)
{
~        dllc_t *dllc;

~        if (!priv) return;
~        dllc = priv->llc;
~        if (!dllc) return;

~        if (txresult != 0) {
~                dllc->stats.tx_errors++;
~        }
~        else {
~                dllc->stats.tx_packets++;
~        }
~        dllc_flush_queue(priv);
}

void dllc_flush_queue(driver_priv_t* priv)
{
~        dllc_t *dllc;

~        if (!priv) return;
~        dllc = priv->llc;
~        if (!dllc) return;

~        spin_lock_bh(&tx_lock);

~        if (!dllc->tx_packets_in_queue &&  dllc->netif_stopped){
~                netif_wake_queue(dllc->dev);
~                dllc->netif_stopped = 0;
~        }
~        /* if there is data to send */
~        if (dllc_get_from_queue (dllc))
~                mod_timer(&dllc->timer, jiffies);

~        spin_unlock_bh(&tx_lock);
}


/* Called by e.g ifconfig to get device stats */

static struct net_device_stats* dllc_devgetstats(device_t *dev)
{
~        dllc_t *dllc;

~        if (!dev) return NULL;
~        dllc = dev->priv;
~        if(!dllc) return NULL;

~        return &dllc->stats;
}

/* Set multicast list for netdev */
#define MAX_MULTI_ADDRESSES 15

static void dllc_devset_multicast_list(device_t *dev)
{
~        dllc_t *dllc;
~        struct dev_mc_list *dmi;
~        int i, length = 0;
~        UINT8 mac_addrs[MAC_ADDR_SIZE*MAX_MULTI_ADDRESSES]; // 15 MAC
addresses
#ifdef D_DEBUG
~        UINT8 mac_buf[MAC_ADDR_SIZE+BUFEXTRA];
#endif

~        if (!dev){
~                DEBUG ("dev NULL\n");
~                return;
~        }

~        dmi=dev->mc_list;
~        dllc = dev->priv;
~        if(!dllc || !dllc->priv || !dmi){
~                DEBUG ("NULL parameters\n");
~                return;
~        }

~        if (dev->flags & IFF_PROMISC) {
~                /* Promiscuous mode not supported */
~                ERROR ("Promiscuous mode not supported\n");
~        }
~        if ((dev->flags & IFF_ALLMULTI) ||
(dev->mc_count>MAX_MULTI_ADDRESSES)){
~                DEBUG("%s: setting all multicast Rx mode (%02X, %d
addresses).\n", dev->name, dev->flags, dev->mc_count);
~                /* receive all multicasts, mc_count=1 and
mac_addrs==NULL  is magic */
~                dhw_set_multicast_addresses(dllc->priv->hw, 1, NULL,
length);
~                return;
~        }
~        else if (dev->mc_count) {
~                DEBUG("%s: setting multicast Rx mode %02X to %d
addresses.\n", dev->name, dev->flags, dev->mc_count);
~                /* use HW filter for multicasts */
~                for (i=0;i<dev->mc_count;i++) {
~                        DEBUG("Multicast MAC:
%s\n",dt_printmac(dmi->dmi_addr, mac_buf));
~                        memcpy(mac_addrs+length, dmi->dmi_addr,
MAC_ADDR_SIZE);
~                        dmi = dmi->next;
~                        length = length + MAC_ADDR_SIZE;
~                }
~                length = dev->mc_count * MAC_ADDR_SIZE;
~                dhw_set_multicast_addresses(dllc->priv->hw,
dev->mc_count, mac_addrs, length);
~                return;
~        }
~        else if (dev->mc_count == 0) {
~                DEBUG("%s: setting multicast disabled Rx mode (%02X, %d
addresses).\n", dev->name, dev->flags, dev->mc_count);
~                /* Normal mode */
~                dhw_set_multicast_addresses(dllc->priv->hw, 0, 0, 0);
~        }
~        return;
}

/* Ioctl interface to user apps */

static int dllc_devdo_ioctl(device_t *dev, void *req, int cmd)
{
~        return 0;
}


/* Frame received from radio, and you should send it to system */

void dllc_rxframe(driver_priv_t *priv, MAC src, MAC dest, INT16 type,
UINT8 *frm, UINT32 len)
{
~        struct sk_buff	*skb;
~        dllc_t *dllc;

~        if (!priv) return;
~        dllc = priv->llc;
~        if(!dllc) return;
~        if(!dllc->dev) return;

~        if ( !netif_running(dllc->dev) )
~                return;

~        skb = dev_alloc_skb(len + 14 + 2);
~        if (!skb) {
~                return;
~        }

~        dllc->dev->last_rx = jiffies;

~        skb->dev = dllc->dev;

~        skb->ip_summed = CHECKSUM_UNNECESSARY;

~        skb_put( skb, len+14);	

~        memcpy( &skb->data[0] , dest , sizeof(MAC));
~        memcpy( &skb->data[6] , src  , sizeof(MAC));
~        memcpy( &skb->data[12], &type, sizeof(INT16));
~        memcpy( &skb->data[14], frm  , len);

~        skb->protocol = eth_type_trans( skb, dllc->dev);

~        dllc->stats.rx_packets++;

~        netif_rx(skb);
}


INT dllc_get_my_mac_addr(driver_priv_t* priv, char* mac){
~        if (!priv) return FALSE;
~        if (!priv->llc) return FALSE;
~        if (!priv->llc->dev) return FALSE;
~        if (!mac) return FALSE;
~        memcpy (mac, priv->llc->dev->dev_addr, MAC_ADDR_SIZE);
~        return TRUE;
}

void dllc_set_my_mac_addr(driver_priv_t* priv, char* mac){
~        if (!priv || !priv->llc || !priv->llc->dev || !mac){
~                ERROR ("dllc_set_my_mac_addr: NULL parameters\n");
~                return;
~        }
~        dmemcpy(priv->llc->dev->dev_addr, mac, MAC_ADDR_SIZE);
}

/* queue handling */

static buf_t* dllc_get_empty(dllc_t *dllc);
static void dllc_insert_empty(dllc_t *dllc, buf_t* bd);
static buf_t* dllc_get_tail (dllc_t *dllc);
static buf_t* dllc_remove_tail (dllc_t *dllc);
static void dllc_put_first (dllc_t *dllc, buf_t* bd);

static struct sk_buff *dllc_get_from_queue (dllc_t *dllc){
~        struct sk_buff *skb = NULL;
~        buf_t *bd = dllc_get_tail(dllc);
~        if (!bd)
~                return NULL;

~        skb = bd->skb;
~        return skb;
}

static struct sk_buff *dllc_remove_from_queue (dllc_t *dllc){
~        struct sk_buff *skb;
~        buf_t *bd = dllc_remove_tail(dllc);
~        if (!bd){
~                DEBUG ("bd NULL\n");
~                return NULL;
~        }
~        skb = bd->skb;
~        dllc_insert_empty (dllc, bd);
~        return skb;
}

static INT dllc_put_to_queue (dllc_t *dllc, struct sk_buff *skb){
~        buf_t *bd;
~        if (!skb)
~                return FALSE;

~        bd = dllc_get_empty(dllc);
~        if (!bd)
~                return FALSE;

~        bd->skb = skb;
~        dllc_put_first(dllc, bd);
~        return TRUE;
}

static INT dllc_init_queue(dllc_t *dllc){
~        int i;
~        buf_t* bd = NULL;

~        dllc->tail_queue = NULL;
~        dllc->head_queue = NULL;
~        dllc->head_empty = NULL;

~        for ( i=0; i < QUEUE_SIZE; i++){
~                bd = kmalloc (sizeof(buf_t), GFP_KERNEL); //should we
allocate a single memory reg?
~                if (!bd){
~                        ERROR ("memory allocation failed\n");
~                        return FALSE;
~                }
~                dllc_insert_empty (dllc, bd);
~        }
~        return TRUE;
}

static void dllc_close_queue(dllc_t *dllc){
~        buf_t* tmp;
~        struct sk_buff *skb;

~        while ( (skb = dllc_remove_from_queue(dllc)) ){
~                dev_kfree_skb(skb);
~                dllc->stats.tx_errors++;
~                dllc->tx_packets_dropped++;
~        }
~        while ( (tmp = dllc_get_empty(dllc)) ){
~                kfree (tmp);
~        }
}


/* get buffer from the tail of the queue */

static buf_t* dllc_get_tail (dllc_t *dllc){
~        if (!dllc->tail_queue){ /* empty list */
~                return NULL;
~        }
~        return dllc->tail_queue;
}

static buf_t* dllc_remove_tail (dllc_t *dllc){
~        buf_t* tmp;
~        if (!dllc->tail_queue){ /* empty list */
~                return NULL;
~        }
~        tmp = dllc->tail_queue;
~        dllc->tail_queue = dllc->tail_queue->prev;
~        if (dllc->tail_queue)
~                dllc->tail_queue->next = NULL;
~        else
~                dllc->head_queue = NULL;

~        return tmp;
}

/* put new buffer to head of the queue, according to the sortkey */

static void dllc_put_first (dllc_t *dllc, buf_t* bd){
~        bd->next = NULL;
~        bd->prev = NULL;
~        if (!dllc->head_queue){ /* empty list */
~                dllc->head_queue = bd;
~                dllc->tail_queue = bd;
~                return;
~        }
~        dllc->head_queue->prev = bd;
~        bd->next = dllc->head_queue;
~        dllc->head_queue = bd;

~        return;
}

static void dllc_insert_empty(dllc_t *dllc, buf_t* bd){
~        buf_t* tmp;
~        bd->next = NULL;
~        bd->prev = NULL;
~        bd->skb = NULL;

~        if (!dllc->head_empty){ /* empty list */
~                dllc->head_empty = bd;
~                return;
~        }

~        tmp = dllc->head_empty;
~        while (tmp->next != NULL)
~                tmp = tmp->next;

~        tmp->next = bd;
}

static buf_t* dllc_get_empty(dllc_t *dllc){
~        buf_t* tmp;
~        if (!dllc->head_empty){ /* empty list */
~                return NULL;
~        }
~        tmp = dllc->head_empty;
~        dllc->head_empty = dllc->head_empty->next;

~        tmp->next = NULL;
~        tmp->prev = NULL;
~        tmp->skb = NULL;
~        return tmp;
}
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFAQIhRrPQTyNB9u9YRAo5kAJwOb/GOyFfZMPMAI+AXHSfyzaPiPACgifie
jIv7h5l8L3raCtbJu2ktCYM=
=4EaU
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Nokia c110 driver
  2004-02-28 12:23 Nokia c110 driver Kliment Yanev
@ 2004-02-28 18:41 ` Randy.Dunlap
  2004-02-28 18:51   ` Kliment Yanev
  2004-02-29  7:51   ` Kliment Yanev
  0 siblings, 2 replies; 16+ messages in thread
From: Randy.Dunlap @ 2004-02-28 18:41 UTC (permalink / raw)
  To: Kliment Yanev; +Cc: linux-kernel

On Sat, 28 Feb 2004 14:23:46 +0200 Kliment Yanev <Kliment.Yanev@helsinki.fi> wrote:

| -----BEGIN PGP SIGNED MESSAGE-----
| Hash: SHA1
| 
| I was attempting to compile the nokia c110 linux driver, meant for 2.4
| kernels, on 2.6.3. Unsurprisingly, it gave me some errors. I suspect
| that the modification to the source would not be too difficult, it just
| seems to use some deprecated functions. I would be very willing to fix
| it myself, however, I am not familiar with the kernel code at all. Here
| are the errors the compile gives. Do you think you could point me in the
| right direction? Below is the source of the file causing the errors as well.
| 
| gcc output starts here:
| 
| set -e; for d in src dctl; do make -C $d ; done
| make[1]: Entering directory `/home/kliment/Desktop/nokia_c110/src'
| gcc -O2 -Wall -Wstrict-prototypes -fomit-frame-pointer -pipe
| - -D__KERNEL__ -DMODULE -I../include -I/usr/src/linux/include     -c  dllc.c
| In file included from /usr/src/linux/include/asm/processor.h:18,
| ~                 from /usr/src/linux/include/asm/thread_info.h:13,
| ~                 from /usr/src/linux/include/linux/thread_info.h:21,
| ~                 from /usr/src/linux/include/linux/spinlock.h:12,
| ~                 from /usr/src/linux/include/linux/capability.h:45,
| ~                 from /usr/src/linux/include/linux/sched.h:7,
| ~                 from /usr/src/linux/include/linux/module.h:10,
| ~                 from nokia_info.h:42,
| ~                 from dllc.c:29:
| /usr/src/linux/include/asm/system.h: In function `__set_64bit_var':
| /usr/src/linux/include/asm/system.h:193: warning: dereferencing
| type-punned pointer will break strict-aliasing rules
| /usr/src/linux/include/asm/system.h:193: warning: dereferencing
| type-punned pointer will break strict-aliasing rules
| In file included from /usr/src/linux/include/linux/irq.h:20,
| ~                 from /usr/src/linux/include/asm/hardirq.h:6,
| ~                 from /usr/src/linux/include/linux/interrupt.h:11,
| ~                 from nokia_info.h:52,
| ~                 from dllc.c:29:
| /usr/src/linux/include/asm/irq.h:16:25: irq_vectors.h: No such file or
| directory
| In file included from /usr/src/linux/include/asm/hardirq.h:6,
| ~                 from /usr/src/linux/include/linux/interrupt.h:11,
| ~                 from nokia_info.h:52,
| ~                 from dllc.c:29:
| /usr/src/linux/include/linux/irq.h: At top level:
| /usr/src/linux/include/linux/irq.h:70: error: `NR_IRQS' undeclared here
| (not in a function)
| In file included from /usr/src/linux/include/linux/irq.h:72,
| ~                 from /usr/src/linux/include/asm/hardirq.h:6,
| ~                 from /usr/src/linux/include/linux/interrupt.h:11,
| ~                 from nokia_info.h:52,
| ~                 from dllc.c:29:
| /usr/src/linux/include/asm/hw_irq.h:28: error: `NR_IRQ_VECTORS'
| undeclared here (not in a function)
| /usr/src/linux/include/asm/hw_irq.h:31: error: `NR_IRQS' undeclared here
| (not in a function)
| In file included from nokia_info.h:89,
| ~                 from dllc.c:29:
| nokia_priv.h:43:1: warning: "HZ" redefined
| In file included from /usr/src/linux/include/linux/sched.h:4,
| ~                 from /usr/src/linux/include/linux/module.h:10,
| ~                 from nokia_info.h:42,
| ~                 from dllc.c:29:
| /usr/src/linux/include/asm/param.h:5:1: warning: this is the location of
| the previous definition
| dllc.c: In function `dllc_devopen':
| dllc.c:156: warning: `MOD_INC_USE_COUNT' is deprecated (declared at
| /usr/src/linux/include/linux/module.h:488)
| dllc.c: In function `dllc_devstop':
| dllc.c:169: warning: `MOD_DEC_USE_COUNT' is deprecated (declared at
| /usr/src/linux/include/linux/module.h:500)
| make[1]: *** [dllc.o] Error 1
| make[1]: Leaving directory `/home/kliment/Desktop/nokia_c110/src'
| make: *** [all] Error 2
| 
| gcc errors end here
| dllc.c starts here:
[snip]

What is this driver for?  Where can I find it?

All those errors should go away if you build the module correctly.
Please read Documentation/kbuild/m*.txt or see LWN.net article
on building modules:
  http://lwn.net/Articles/21823/

--
~Randy

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Nokia c110 driver
  2004-02-28 18:41 ` Randy.Dunlap
@ 2004-02-28 18:51   ` Kliment Yanev
  2004-02-29  7:51   ` Kliment Yanev
  1 sibling, 0 replies; 16+ messages in thread
From: Kliment Yanev @ 2004-02-28 18:51 UTC (permalink / raw)
  To: Randy.Dunlap; +Cc: linux-kernel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

|
| What is this driver for?  Where can I find it?

The nokia c110 is a prism2-based wireless lan card that does not
work with the normal prism driver because it has a different controller
and a big pile of extra unneeded and unsupported stuff like a smartcard
reader...

Available here:

http://www.nokia.com/nokia/0,5184,2718,00.html

|
| All those errors should go away if you build the module correctly.
| Please read Documentation/kbuild/m*.txt or see LWN.net article
| on building modules:
|   http://lwn.net/Articles/21823/

Thanks...I'll try that...however I just realized I don't even have a
linux driver for the pci to pcmcia cradle that it's supposed to work
with (i82365-compatible PCI card support was dropped from the kernel
driver and pcmcia-cs driver won't build if there is pcmcia support in
the kernel and the whole package won't compile without pcmcia support in
the kernel...)
Therefore, I won't be able to test this until I get a laptop in use in
two weeks time...

|
| --
| ~Randy

Kliment
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFAQOM1rPQTyNB9u9YRAt3CAJ0fbmpZkjZzrqszDokBiHzLjKjSdwCgmRax
Dwb+j0DcIDSYuWyRqdxdZ4Y=
=NMOm
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Nokia c110 driver
  2004-02-28 18:41 ` Randy.Dunlap
  2004-02-28 18:51   ` Kliment Yanev
@ 2004-02-29  7:51   ` Kliment Yanev
  2004-03-01 18:17     ` Randy.Dunlap
  1 sibling, 1 reply; 16+ messages in thread
From: Kliment Yanev @ 2004-02-29  7:51 UTC (permalink / raw)
  To: Randy.Dunlap; +Cc: linux-kernel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



Randy.Dunlap wrote:
| All those errors should go away if you build the module correctly.
| Please read Documentation/kbuild/m*.txt or see LWN.net article
| on building modules:
|   http://lwn.net/Articles/21823/

Okay, using a kbuild makefile I still get tons of errors, though most of
the original ones are gone:

make -C /lib/modules/2.6.3-rc2-mm1/build
SUBDIRS=/home/kliment/Desktop/nokia_c110/src modules
make[1]: Entering directory `/usr/src/linux-2.6.3-rc2-mm1'
*** Warning: Overriding SUBDIRS on the command line can cause
***          inconsistencies
make[2]: `arch/i386/kernel/asm-offsets.s' is up to date.
~  CHK     include/asm-i386/asm_offsets.h
~  CC [M]  /home/kliment/Desktop/nokia_c110/src/dmodule.o
In file included from /home/kliment/Desktop/nokia_c110/src/nokia_info.h:89,
~                 from /home/kliment/Desktop/nokia_c110/src/dmodule.c:35:
/home/kliment/Desktop/nokia_c110/src/nokia_priv.h:43:1: warning: "HZ"
redefined
In file included from include/linux/sched.h:4,
~                 from include/linux/module.h:10,
~                 from /home/kliment/Desktop/nokia_c110/src/nokia_info.h:42,
~                 from /home/kliment/Desktop/nokia_c110/src/dmodule.c:35:
include/asm/param.h:5:1: warning: this is the location of the previous
definition
/home/kliment/Desktop/nokia_c110/src/dmodule.c:57: warning: static
declaration for `cs_error' follows non-static
/home/kliment/Desktop/nokia_c110/src/dmodule.c: In function `cs_error':
/home/kliment/Desktop/nokia_c110/src/dmodule.c:61: warning: implicit
declaration of function `CardServices'
/home/kliment/Desktop/nokia_c110/src/dmodule.c: In function `d_init_module':
/home/kliment/Desktop/nokia_c110/src/dmodule.c:115: warning: implicit
declaration of function `register_pcmcia_driver'
/home/kliment/Desktop/nokia_c110/src/dmodule.c: In function
`d_cleanup_module':
/home/kliment/Desktop/nokia_c110/src/dmodule.c:124: warning: implicit
declaration of function `unregister_pccard_driver'
/home/kliment/Desktop/nokia_c110/src/dmodule.c: In function
`d_driver_attach':
/home/kliment/Desktop/nokia_c110/src/dmodule.c:182: error: structure has
no member named `release'
/home/kliment/Desktop/nokia_c110/src/dmodule.c:183: error: structure has
no member named `release'
/home/kliment/Desktop/nokia_c110/src/dmodule.c: In function
`d_driver_event':
/home/kliment/Desktop/nokia_c110/src/dmodule.c:401: error: structure has
no member named `release'
/home/kliment/Desktop/nokia_c110/src/dmodule.c:402: error: structure has
no member named `release'
/home/kliment/Desktop/nokia_c110/src/dmodule.c:407: error: structure has
no member named `bus'
make[2]: *** [/home/kliment/Desktop/nokia_c110/src/dmodule.o] Error 1
make[1]: *** [/home/kliment/Desktop/nokia_c110/src] Error 2
make[1]: Leaving directory `/usr/src/linux-2.6.3-rc2-mm1'
make: *** [default] Error 2


Other than the param.h error, all the errors related to kernel headers
are gone now. Thank you for the suggestion. However, what do I do next?
I got the pci-pcmcia converter working btw. It needed its base address
entered manually as well as irq scanning disabled and it would hang the
machine otherwise...Therefore I can test this now if it compiles.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFAQZocrPQTyNB9u9YRAtx8AKCBm+p8mSJYSDq0BO5kojTVkSTkKQCgoY+a
lR6FZayR6upvyBNtLnahoUo=
=WsqF
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Nokia c110 driver
  2004-02-29  7:51   ` Kliment Yanev
@ 2004-03-01 18:17     ` Randy.Dunlap
  2004-03-08 14:59       ` Kliment Yanev
  0 siblings, 1 reply; 16+ messages in thread
From: Randy.Dunlap @ 2004-03-01 18:17 UTC (permalink / raw)
  To: Kliment Yanev; +Cc: linux-kernel

On Sun, 29 Feb 2004 09:51:56 +0200 Kliment Yanev wrote:

| -----BEGIN PGP SIGNED MESSAGE-----
| Hash: SHA1
| 
| 
| 
| Randy.Dunlap wrote:
| | All those errors should go away if you build the module correctly.
| | Please read Documentation/kbuild/m*.txt or see LWN.net article
| | on building modules:
| |   http://lwn.net/Articles/21823/
| 
| Okay, using a kbuild makefile I still get tons of errors, though most of
| the original ones are gone:
| 
| make -C /lib/modules/2.6.3-rc2-mm1/build
| SUBDIRS=/home/kliment/Desktop/nokia_c110/src modules
| make[1]: Entering directory `/usr/src/linux-2.6.3-rc2-mm1'
| *** Warning: Overriding SUBDIRS on the command line can cause
| ***          inconsistencies
| make[2]: `arch/i386/kernel/asm-offsets.s' is up to date.
| ~  CHK     include/asm-i386/asm_offsets.h
| ~  CC [M]  /home/kliment/Desktop/nokia_c110/src/dmodule.o
| In file included from /home/kliment/Desktop/nokia_c110/src/nokia_info.h:89,
| ~                 from /home/kliment/Desktop/nokia_c110/src/dmodule.c:35:
| /home/kliment/Desktop/nokia_c110/src/nokia_priv.h:43:1: warning: "HZ"
| redefined

This shouldn't define HZ -- or make it conditional.

| In file included from include/linux/sched.h:4,
| ~                 from include/linux/module.h:10,
| ~                 from /home/kliment/Desktop/nokia_c110/src/nokia_info.h:42,
| ~                 from /home/kliment/Desktop/nokia_c110/src/dmodule.c:35:
| include/asm/param.h:5:1: warning: this is the location of the previous
| definition
| /home/kliment/Desktop/nokia_c110/src/dmodule.c:57: warning: static
| declaration for `cs_error' follows non-static

'cs_error' is a function in the kernel.  Rename this local one.

| /home/kliment/Desktop/nokia_c110/src/dmodule.c: In function `cs_error':
| /home/kliment/Desktop/nokia_c110/src/dmodule.c:61: warning: implicit
| declaration of function `CardServices'
| /home/kliment/Desktop/nokia_c110/src/dmodule.c: In function `d_init_module':
| /home/kliment/Desktop/nokia_c110/src/dmodule.c:115: warning: implicit
| declaration of function `register_pcmcia_driver'
| /home/kliment/Desktop/nokia_c110/src/dmodule.c: In function
| `d_cleanup_module':
| /home/kliment/Desktop/nokia_c110/src/dmodule.c:124: warning: implicit
| declaration of function `unregister_pccard_driver'
| /home/kliment/Desktop/nokia_c110/src/dmodule.c: In function
| `d_driver_attach':
| /home/kliment/Desktop/nokia_c110/src/dmodule.c:182: error: structure has
| no member named `release'
| /home/kliment/Desktop/nokia_c110/src/dmodule.c:183: error: structure has
| no member named `release'
| /home/kliment/Desktop/nokia_c110/src/dmodule.c: In function
| `d_driver_event':
| /home/kliment/Desktop/nokia_c110/src/dmodule.c:401: error: structure has
| no member named `release'
| /home/kliment/Desktop/nokia_c110/src/dmodule.c:402: error: structure has
| no member named `release'
| /home/kliment/Desktop/nokia_c110/src/dmodule.c:407: error: structure has
| no member named `bus'
| make[2]: *** [/home/kliment/Desktop/nokia_c110/src/dmodule.o] Error 1
| make[1]: *** [/home/kliment/Desktop/nokia_c110/src] Error 2
| make[1]: Leaving directory `/usr/src/linux-2.6.3-rc2-mm1'
| make: *** [default] Error 2
| 
| 
| Other than the param.h error, all the errors related to kernel headers
| are gone now. Thank you for the suggestion. However, what do I do next?
| I got the pci-pcmcia converter working btw. It needed its base address
| entered manually as well as irq scanning disabled and it would hang the
| machine otherwise...Therefore I can test this now if it compiles.

All of the kernel interface functions to PCMCIA Card Services have
changed in 2.6 so quite a bit of code will have to be changed here.
You can ask Nokia for a 2.6 update since it is now released, or
you can ask for help from the linux-wlan (or wlan-ng) project people,
or you can compare a 2.4 PCMCIA kernel driver to a 2.6 PCMCIA kernel
driver to see what changes are required.

--
~Randy

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Nokia c110 driver
  2004-03-01 18:17     ` Randy.Dunlap
@ 2004-03-08 14:59       ` Kliment Yanev
  2004-03-08 17:06         ` Randy.Dunlap
  0 siblings, 1 reply; 16+ messages in thread
From: Kliment Yanev @ 2004-03-08 14:59 UTC (permalink / raw)
  To: Randy.Dunlap; +Cc: linux-kernel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



Randy.Dunlap wrote:

| All of the kernel interface functions to PCMCIA Card Services have
| changed in 2.6 so quite a bit of code will have to be changed here.
| You can ask Nokia for a 2.6 update since it is now released, or
| you can ask for help from the linux-wlan (or wlan-ng) project people,
| or you can compare a 2.4 PCMCIA kernel driver to a 2.6 PCMCIA kernel
| driver to see what changes are required.
|

I compared the orinoco_cs drivers in 2.4 and 2.6 and I updated the nokia
driver source. However now I get "-1 unknown symbol in module" when I
try to insmod the module... where should I start troubleshooting?

| --
| ~Randy
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFATIo1rPQTyNB9u9YRAgVTAJ4vJ/S7mWWcU30fvKpzcRM9nKmpxgCfZ4nZ
q4G1syI9QNWxqCDjTlULzwk=
=I5O4
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Nokia c110 driver
  2004-03-08 14:59       ` Kliment Yanev
@ 2004-03-08 17:06         ` Randy.Dunlap
  2004-03-08 22:45           ` Kliment Yanev
  0 siblings, 1 reply; 16+ messages in thread
From: Randy.Dunlap @ 2004-03-08 17:06 UTC (permalink / raw)
  To: Kliment Yanev; +Cc: linux-kernel

On Mon, 08 Mar 2004 16:59:01 +0200 Kliment Yanev wrote:

| -----BEGIN PGP SIGNED MESSAGE-----
| Hash: SHA1
| 
| 
| 
| Randy.Dunlap wrote:
| 
| | All of the kernel interface functions to PCMCIA Card Services have
| | changed in 2.6 so quite a bit of code will have to be changed here.
| | You can ask Nokia for a 2.6 update since it is now released, or
| | you can ask for help from the linux-wlan (or wlan-ng) project people,
| | or you can compare a 2.4 PCMCIA kernel driver to a 2.6 PCMCIA kernel
| | driver to see what changes are required.
| |
| 
| I compared the orinoco_cs drivers in 2.4 and 2.6 and I updated the nokia
| driver source. However now I get "-1 unknown symbol in module" when I
| try to insmod the module... where should I start troubleshooting?

Set the console loglevel to 9 so that you can see all of the
kernel messages and then try to reload the module.  Some explanatory
error message should appear to indicate the problem area.

--
~Randy

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Nokia c110 driver
  2004-03-08 17:06         ` Randy.Dunlap
@ 2004-03-08 22:45           ` Kliment Yanev
  2004-03-08 23:09             ` Randy.Dunlap
  0 siblings, 1 reply; 16+ messages in thread
From: Kliment Yanev @ 2004-03-08 22:45 UTC (permalink / raw)
  To: Randy.Dunlap; +Cc: linux-kernel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



Randy.Dunlap wrote:

| |
| | I compared the orinoco_cs drivers in 2.4 and 2.6 and I updated the nokia
| | driver source. However now I get "-1 unknown symbol in module" when I
| | try to insmod the module... where should I start troubleshooting?
|
| Set the console loglevel to 9 so that you can see all of the
| kernel messages and then try to reload the module.  Some explanatory
| error message should appear to indicate the problem area.
|

dmesg handled that. dmesg output below (there was also an
"unknown symbol CardServices" but I fixed that bu replacing all
references to CardServices with the pcmcia_functionname functions.
What are the replacements for these then? (The license string I can
correct myself)

nokia_c110: module license 'unspecified' taints kernel.
nokia_c110: Unknown symbol dcfg_new
nokia_c110: Unknown symbol dllc_register
nokia_c110: Unknown symbol dllc_delete
nokia_c110: Unknown symbol dfree
nokia_c110: Unknown symbol ddev_register
nokia_c110: Unknown symbol dmgr_pcmcia_action
nokia_c110: Unknown symbol dcfg_delete
nokia_c110: Unknown symbol dmgr_new
nokia_c110: Unknown symbol dllc_new
nokia_c110: Unknown symbol dprintk
nokia_c110: Unknown symbol dllc_set_my_mac_addr
nokia_c110: Unknown symbol dmgr_delete
nokia_c110: Unknown symbol ddev_unregister
nokia_c110: Unknown symbol dhw_get_my_mac
nokia_c110: Unknown symbol dhw_delete
nokia_c110: Unknown symbol dhw_new
nokia_c110: Unknown symbol dhw_ISR
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFATPd5rPQTyNB9u9YRAogGAJ4rJ/1b/jYIV9cVoMNtxHcSLWJAFgCfSHRx
yWUBscVlvQKL/xdQ1biVXK4=
=ezLe
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Nokia c110 driver
  2004-03-08 22:45           ` Kliment Yanev
@ 2004-03-08 23:09             ` Randy.Dunlap
  2004-03-08 23:22               ` Kliment Yanev
  0 siblings, 1 reply; 16+ messages in thread
From: Randy.Dunlap @ 2004-03-08 23:09 UTC (permalink / raw)
  To: Kliment Yanev; +Cc: linux-kernel

On Tue, 09 Mar 2004 00:45:14 +0200 Kliment Yanev wrote:

| -----BEGIN PGP SIGNED MESSAGE-----
| Hash: SHA1
| 
| 
| 
| Randy.Dunlap wrote:
| 
| | |
| | | I compared the orinoco_cs drivers in 2.4 and 2.6 and I updated the nokia
| | | driver source. However now I get "-1 unknown symbol in module" when I
| | | try to insmod the module... where should I start troubleshooting?
| |
| | Set the console loglevel to 9 so that you can see all of the
| | kernel messages and then try to reload the module.  Some explanatory
| | error message should appear to indicate the problem area.
| |
| 
| dmesg handled that. dmesg output below (there was also an
| "unknown symbol CardServices" but I fixed that bu replacing all
| references to CardServices with the pcmcia_functionname functions.
| What are the replacements for these then? (The license string I can
| correct myself)
| 
| nokia_c110: module license 'unspecified' taints kernel.
| nokia_c110: Unknown symbol dcfg_new
| nokia_c110: Unknown symbol dllc_register
| nokia_c110: Unknown symbol dllc_delete
| nokia_c110: Unknown symbol dfree
| nokia_c110: Unknown symbol ddev_register
| nokia_c110: Unknown symbol dmgr_pcmcia_action
| nokia_c110: Unknown symbol dcfg_delete
| nokia_c110: Unknown symbol dmgr_new
| nokia_c110: Unknown symbol dllc_new
| nokia_c110: Unknown symbol dprintk
| nokia_c110: Unknown symbol dllc_set_my_mac_addr
| nokia_c110: Unknown symbol dmgr_delete
| nokia_c110: Unknown symbol ddev_unregister
| nokia_c110: Unknown symbol dhw_get_my_mac
| nokia_c110: Unknown symbol dhw_delete
| nokia_c110: Unknown symbol dhw_new
| nokia_c110: Unknown symbol dhw_ISR

I have no idea where these symbols live or come from.

You know, it's possible that you could purchase a card that already
works on Linux 2.6.... that might be a better solution than trying
to use an unknown binary module.

--
~Randy

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Nokia c110 driver
  2004-03-08 23:09             ` Randy.Dunlap
@ 2004-03-08 23:22               ` Kliment Yanev
  2004-03-08 23:36                 ` Randy.Dunlap
  0 siblings, 1 reply; 16+ messages in thread
From: Kliment Yanev @ 2004-03-08 23:22 UTC (permalink / raw)
  To: Randy.Dunlap; +Cc: linux-kernel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



Randy.Dunlap wrote:

|
| I have no idea where these symbols live or come from.

I found them! they are in the binary-only part of the driver but for
some reason they are not getting linked into the .ko file. I tried
linking them manually but then I get an "invalid module format"

|
| You know, it's possible that you could purchase a card that already
| works on Linux 2.6.... that might be a better solution than trying
| to use an unknown binary module.

At this point I am doing this just to see if it will work... I don't
need the card for another week or so and if I don't get this one to work
I'll just buy another one. Yet I have the feeling that this card will
work before long... if only I could get those files linked that is...

My makefile (dhw, dap, dmgr and dcfg are in the binary parts, present in
the current dir as dhw.o etc.; all the others are .c files that get
compiled during a make):

~    ifneq ($(KERNELRELEASE),)
~    obj-m       := nokia_c110.o
~    module-objs := dllc.o dtools.o dhw.o dap.o dmgr.o dcfg.o

~    else
~    KDIR        := /lib/modules/$(shell uname -r)/build
~    PWD         := $(shell pwd)

~    default:
~        $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
~    endif


|

Thanks for all your help so far.

Kliment
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFATQAyrPQTyNB9u9YRAul8AKCgtRfIC65TDVxGNdsyZtnD9mMOKQCgl7Pe
qhYXJJggGUVYzNjBdN3tphU=
=/fei
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Nokia c110 driver
  2004-03-08 23:22               ` Kliment Yanev
@ 2004-03-08 23:36                 ` Randy.Dunlap
  2004-03-09 13:26                   ` Kliment Yanev
  0 siblings, 1 reply; 16+ messages in thread
From: Randy.Dunlap @ 2004-03-08 23:36 UTC (permalink / raw)
  To: Kliment Yanev; +Cc: linux-kernel

On Tue, 09 Mar 2004 01:22:26 +0200 Kliment Yanev wrote:

| -----BEGIN PGP SIGNED MESSAGE-----
| Hash: SHA1
| 
| 
| 
| Randy.Dunlap wrote:
| 
| |
| | I have no idea where these symbols live or come from.
| 
| I found them! they are in the binary-only part of the driver but for
| some reason they are not getting linked into the .ko file. I tried
| linking them manually but then I get an "invalid module format"

I looked there but didn't see such symbols (using 'nm').
What did you use to see them?
The strings that I see all seem to contain 16-bit characters.


| | You know, it's possible that you could purchase a card that already
| | works on Linux 2.6.... that might be a better solution than trying
| | to use an unknown binary module.

Well, Sam Ravnborg did post a patch in the last week or so that
should help with (some) binary files...  probably .o and not .bin,
or maybe it doesn't matter.


| At this point I am doing this just to see if it will work... I don't
| need the card for another week or so and if I don't get this one to work
| I'll just buy another one. Yet I have the feeling that this card will
| work before long... if only I could get those files linked that is...
| 
| My makefile (dhw, dap, dmgr and dcfg are in the binary parts, present in
| the current dir as dhw.o etc.; all the others are .c files that get
| compiled during a make):
| 
| ~    ifneq ($(KERNELRELEASE),)
| ~    obj-m       := nokia_c110.o
| ~    module-objs := dllc.o dtools.o dhw.o dap.o dmgr.o dcfg.o
| 
| ~    else
| ~    KDIR        := /lib/modules/$(shell uname -r)/build
| ~    PWD         := $(shell pwd)
| 
| ~    default:
| ~        $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
| ~    endif

--
~Randy

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Nokia c110 driver
  2004-03-08 23:36                 ` Randy.Dunlap
@ 2004-03-09 13:26                   ` Kliment Yanev
  2004-03-09 16:04                     ` Randy.Dunlap
  0 siblings, 1 reply; 16+ messages in thread
From: Kliment Yanev @ 2004-03-09 13:26 UTC (permalink / raw)
  To: Randy.Dunlap; +Cc: linux-kernel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



Randy.Dunlap wrote:
|
| I looked there but didn't see such symbols (using 'nm').
| What did you use to see them?
| The strings that I see all seem to contain 16-bit characters.

dhw.o, dap.o, dmgr.o and dcfg.o are located in nokia_cs.a, which does
not include source. These are the parts that actually access the card
and configure frequencies etc. They don't seem to be linked, since the
dhw_* symbols are unknown in the module. Manually linking them with the
.ko prevents it from being loaded (or maybe I am linking them wrong).
They are defined in corresponding .h files mostly. I think that should
handle all of them. nm sees the symbols in those .o files and in
nokia_cs.a where they came from, but I haven't checked if all of them
are there (I will do so soon). Note that nokia_cs.a is in the binary
package where the firmware is. It is not the same as the firmware file
(smac*.bin).

I am not at all familiar with kbuild (other than the driver porting
howto) and actually have not even written c code before attempting this
driver. Can you advise me on how to link external files like this into a
.ko without breaking the module?


|
|
| | | You know, it's possible that you could purchase a card that already
| | | works on Linux 2.6.... that might be a better solution than trying
| | | to use an unknown binary module.
|
| Well, Sam Ravnborg did post a patch in the last week or so that
| should help with (some) binary files...  probably .o and not .bin,
| or maybe it doesn't matter.
|

Clarify please. A patch to kbuild? Or to the kernel? Note that the .bin
file is only the card firmware. No point looking in that for anything.
The binary part of the _driver_ is in nokia_cs.a, which contains .o files.

|
| | At this point I am doing this just to see if it will work... I don't
| | need the card for another week or so and if I don't get this one to work
| | I'll just buy another one. Yet I have the feeling that this card will
| | work before long... if only I could get those files linked that is...
| |
| | My makefile (dhw, dap, dmgr and dcfg are in the binary parts, present in
| | the current dir as dhw.o etc.; all the others are .c files that get
| | compiled during a make):
| |
| | ~    ifneq ($(KERNELRELEASE),)
| | ~    obj-m       := nokia_c110.o
| | ~    module-objs := dllc.o dtools.o dhw.o dap.o dmgr.o dcfg.o
| |
| | ~    else
| | ~    KDIR        := /lib/modules/$(shell uname -r)/build
| | ~    PWD         := $(shell pwd)
| |
| | ~    default:
| | ~        $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
| | ~    endif

Can you tell me if the makefile is correct?

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFATcYhrPQTyNB9u9YRAmHAAKCgpcd4WMfVsO7VAIhrQruuYdBKSgCfY72J
f6HeLO79lWj3S+bZcuqYiOQ=
=6UIa
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Nokia c110 driver
  2004-03-09 13:26                   ` Kliment Yanev
@ 2004-03-09 16:04                     ` Randy.Dunlap
  2004-03-09 19:27                       ` Sam Ravnborg
  0 siblings, 1 reply; 16+ messages in thread
From: Randy.Dunlap @ 2004-03-09 16:04 UTC (permalink / raw)
  To: Kliment Yanev; +Cc: linux-kernel

On Tue, 09 Mar 2004 15:26:58 +0200 Kliment Yanev wrote:

| 
| Randy.Dunlap wrote:
| |
| | I looked there but didn't see such symbols (using 'nm').
| | What did you use to see them?
| | The strings that I see all seem to contain 16-bit characters.
| 
| dhw.o, dap.o, dmgr.o and dcfg.o are located in nokia_cs.a, which does
| not include source. These are the parts that actually access the card
| and configure frequencies etc. They don't seem to be linked, since the
| dhw_* symbols are unknown in the module. Manually linking them with the
| .ko prevents it from being loaded (or maybe I am linking them wrong).
| They are defined in corresponding .h files mostly. I think that should
| handle all of them. nm sees the symbols in those .o files and in
| nokia_cs.a where they came from, but I haven't checked if all of them
| are there (I will do so soon). Note that nokia_cs.a is in the binary
| package where the firmware is. It is not the same as the firmware file
| (smac*.bin).
| 
| I am not at all familiar with kbuild (other than the driver porting
| howto) and actually have not even written c code before attempting this
| driver. Can you advise me on how to link external files like this into a
| .ko without breaking the module?

Not really, I've never done that.

| | | | You know, it's possible that you could purchase a card that already
| | | | works on Linux 2.6.... that might be a better solution than trying
| | | | to use an unknown binary module.
| |
| | Well, Sam Ravnborg did post a patch in the last week or so that
| | should help with (some) binary files...  probably .o and not .bin,
| | or maybe it doesn't matter.
| |
| 
| Clarify please. A patch to kbuild? Or to the kernel? Note that the .bin
| file is only the card firmware. No point looking in that for anything.
| The binary part of the _driver_ is in nokia_cs.a, which contains .o files.

A patch to kbuild (the kernel makefile system).

You would need to read Sam's emails about this to see how it works.

| | | At this point I am doing this just to see if it will work... I don't
| | | need the card for another week or so and if I don't get this one to work
| | | I'll just buy another one. Yet I have the feeling that this card will
| | | work before long... if only I could get those files linked that is...
| | |
| | | My makefile (dhw, dap, dmgr and dcfg are in the binary parts, present in
| | | the current dir as dhw.o etc.; all the others are .c files that get
| | | compiled during a make):
| | |
| | | ~    ifneq ($(KERNELRELEASE),)
| | | ~    obj-m       := nokia_c110.o
| | | ~    module-objs := dllc.o dtools.o dhw.o dap.o dmgr.o dcfg.o
| | |
| | | ~    else
| | | ~    KDIR        := /lib/modules/$(shell uname -r)/build
| | | ~    PWD         := $(shell pwd)
| | |
| | | ~    default:
| | | ~        $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
| | | ~    endif
| 
| Can you tell me if the makefile is correct?

Sorry, I have no idea.

--
~Randy

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Nokia c110 driver
  2004-03-09 16:04                     ` Randy.Dunlap
@ 2004-03-09 19:27                       ` Sam Ravnborg
  2004-03-09 22:07                         ` Kliment Yanev
  0 siblings, 1 reply; 16+ messages in thread
From: Sam Ravnborg @ 2004-03-09 19:27 UTC (permalink / raw)
  To: Randy.Dunlap; +Cc: Kliment Yanev, linux-kernel

On Tue, Mar 09, 2004 at 08:04:09AM -0800, Randy.Dunlap wrote:
> | 
> | dhw.o, dap.o, dmgr.o and dcfg.o are located in nokia_cs.a, which does
> | not include source. These are the parts that actually access the card
> | and configure frequencies etc. They don't seem to be linked, since the
> | dhw_* symbols are unknown in the module. Manually linking them with the
> | .ko prevents it from being loaded (or maybe I am linking them wrong).
> | They are defined in corresponding .h files mostly.
The above files are normal .o files, that should be linked in.
So what you do is to rename the above files to:
dhw.o_shipped
dap.o_shipped
dmgr.o_shipped
dcfg.o_shipped

And then in your makefile specify:

obj-m	:= cs110.o
cs110-y := dhw.o dap.o dmgr.o dcfg.o
cs110-y += <additional .o files compield from .c files>

Maybe you can specify the .a file direct replacing the four .o file - 
should work but I have not tried.

> | | Well, Sam Ravnborg did post a patch in the last week or so that
> | | should help with (some) binary files...  probably .o and not .bin,
> | | or maybe it doesn't matter.
That patch was crap - the _shipped functionality covers this nicely.

> | | | My makefile (dhw, dap, dmgr and dcfg are in the binary parts, present in
> | | | the current dir as dhw.o etc.; all the others are .c files that get
> | | | compiled during a make):
> | | |
> | | | ~    ifneq ($(KERNELRELEASE),)
> | | | ~    obj-m       := nokia_c110.o
> | | | ~    module-objs := dllc.o dtools.o dhw.o dap.o dmgr.o dcfg.o
Should be:   nokia_c110-y := dllc.o dtools.o dhw.o dap.o dmgr.o dcfg.o
See also example above.

> | | | ~    else
> | | | ~    KDIR        := /lib/modules/$(shell uname -r)/build
> | | | ~    PWD         := $(shell pwd)
> | | |
> | | | ~    default:
> | | | ~        $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
> | | | ~    endif
> | 
> | Can you tell me if the makefile is correct?
Looks OK except for the s/module/nokia_cs110/ point.

	Sam

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Nokia c110 driver
  2004-03-09 19:27                       ` Sam Ravnborg
@ 2004-03-09 22:07                         ` Kliment Yanev
  2004-03-09 22:26                           ` Sam Ravnborg
  0 siblings, 1 reply; 16+ messages in thread
From: Kliment Yanev @ 2004-03-09 22:07 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: Randy.Dunlap, linux-kernel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



Sam Ravnborg wrote:
|
| The above files are normal .o files, that should be linked in.
| So what you do is to rename the above files to:
| dhw.o_shipped
| dap.o_shipped
| dmgr.o_shipped
| dcfg.o_shipped
|
| And then in your makefile specify:
|
| obj-m	:= cs110.o
| cs110-y := dhw.o dap.o dmgr.o dcfg.o
| cs110-y += <additional .o files compield from .c files>
|

It compiled, finally. I have not been able to convince it to create a
device though, but the driver at least loads. Has anything changed in
the handling of netdevices between 2.4 and 2.6 that could cause this
behavior? That is, the pcmcia tools notice the card and load the module,
but then nothing else happens (module usecount 0, no netdevice present)

Is there some kbuild howto somewhere? If not, one is definitely
necessary I think. I had never heard about the _shipped thing (and I did
look around a bit and read and reread the driver porting guide chapter
on kbuild).

Now, is there anyone else that is in possession of this card and can
test the modified driver? I will try and make a patch tomorrow...a lot
of changes were needed and I think it's pretty messy (I am not an
experienced c person) but at least it compiles and loads now.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFATkAFrPQTyNB9u9YRAiNYAJ0XUOMwXrsdfUSwyXARUD0om7B4hQCfQO6N
a+0rrABQO8+/Sp1RWEfUIY4=
=vziv
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Nokia c110 driver
  2004-03-09 22:07                         ` Kliment Yanev
@ 2004-03-09 22:26                           ` Sam Ravnborg
  0 siblings, 0 replies; 16+ messages in thread
From: Sam Ravnborg @ 2004-03-09 22:26 UTC (permalink / raw)
  To: Kliment Yanev; +Cc: Sam Ravnborg, Randy.Dunlap, linux-kernel

> 
> Is there some kbuild howto somewhere? If not, one is definitely
> necessary I think. I had never heard about the _shipped thing (and I did
> look around a bit and read and reread the driver porting guide chapter
> on kbuild).
>From Documentation/kbuild/makefiles.txt:

=== 10 TODO

- Describe how kbuild support shipped files with _shipped.

I'm slowly writing something with main focus on external modules.
This text will include the trick with _shipped.
But until this is finished no luck.

	Sam

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2004-03-09 22:25 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-28 12:23 Nokia c110 driver Kliment Yanev
2004-02-28 18:41 ` Randy.Dunlap
2004-02-28 18:51   ` Kliment Yanev
2004-02-29  7:51   ` Kliment Yanev
2004-03-01 18:17     ` Randy.Dunlap
2004-03-08 14:59       ` Kliment Yanev
2004-03-08 17:06         ` Randy.Dunlap
2004-03-08 22:45           ` Kliment Yanev
2004-03-08 23:09             ` Randy.Dunlap
2004-03-08 23:22               ` Kliment Yanev
2004-03-08 23:36                 ` Randy.Dunlap
2004-03-09 13:26                   ` Kliment Yanev
2004-03-09 16:04                     ` Randy.Dunlap
2004-03-09 19:27                       ` Sam Ravnborg
2004-03-09 22:07                         ` Kliment Yanev
2004-03-09 22:26                           ` Sam Ravnborg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox