Re: [ath9k-devel] can ath9k run on linux 2.6.25

Luis R. Rodriguez
2010-02-13T01:29:10Z

On Wed, Feb 10, 2010 at 7:03 PM, Zhang Yanfei-B21500
<B21500@freescale.com> wrote:
> Hi Luis
>
>    I am porting the compat-wireless-2.6.32-3 to my powerpc platform
> with 2.6.25 kernel.  After disable the LED marco in config.mk i have
> compile it sucess. but when i load it , it show below error messages,
> anyone can help on this?
> the kernel modules manually load order is below: am i right ?
>    1. rfkill_backport
>     2. cfg_802.11
>     3. mac80211
>         4. ath
>         5. ath9k
> #insmod rfkill_backport.ko
> rfkill_backport: Unknown symbol dev_set_name
> insmod: cannot insert 'rfkill_backport.ko': unknown symbol in module
> (-1): No such file or directory
>
>  i found that the compat-2.6.26 have the dev_set_name function, but
> compat-2.6.25 don't have this.

That is the point, so the way the compat-2.6.x files work is that say
you are on 2.6.25 it means you need backport work for 2.6.26, 2.6.27,
2.6.28, 2.6.29, 2.6.30, 2.6.31, 2.6.32 and 2.6.33.

So you get compiled the respective objects for each kernel and these
get linked into a compat module.

dev_set_name() was added as of the 2.6.26 kernel so having it defined
for kernels >= 2.6.25 is correct, and it is also exported.

Only thing I can think of is perhaps rfkill doesn't have the compat.h
header included? I'll check in a while.

>  In new kernel(2.6.29)  it's is device/base/core.c, then i try to copy
> the function into my 2.6.25 kernel.
> but it loss the 'kobject_set_name_vargs', here is the compile
> information.
> $drivers/base/core.c: In function 'dev_set_name':
> $drivers/base/core.c:880: error: implicit declaration of function
> 'kobject_set_name_vargs'

Senthil backported this on compat-2.6.26.c, there are two different
ways to backport this, one for kernels >= 2.6.25 which is at the top
and then for kernels older, at the bottom:

/* 2.6.24 does not have the struct kobject with a name */
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25))

/**
* kobject_set_name_vargs - Set the name of an kobject
* @kobj: struct kobject to set the name of
* @fmt: format string used to build the name
* @vargs: vargs to format the string.
*/
static
int kobject_set_name_vargs(struct kobject *kobj, const char *fmt,
va_list vargs)
{
const char *old_name = kobj->name;
char *s;

if (kobj->name && !fmt)
return 0;

kobj->name = kvasprintf(GFP_KERNEL, fmt, vargs);
if (!kobj->name)
return -ENOMEM;

/* ewww... some of these buggers have '/' in the name ... */
while ((s = strchr(kobj->name, '/')))
s[0] = '!';

kfree(old_name);
return 0;
}
#else
static
int kobject_set_name_vargs(struct kobject *kobj, const char *fmt,
va_list vargs)
{
struct device *dev;
unsigned int len;
va_list aq;

dev = container_of(kobj, struct device, kobj);

va_copy(aq, vargs);
len = vsnprintf(NULL, 0, fmt, aq);
va_end(aq);

len = len < BUS_ID_SIZE ? (len + 1) : BUS_ID_SIZE;

vsnprintf(dev->bus_id, len, fmt, vargs);
return 0;
}
#endif

Luis