Kyle, thanks for reffering,but it seems like GPL is not the case.
I want to write a module to track netdevices present.
Sort of a protocol sitting there. It is GPL'ed, but register_pm_notifier
usage ( as you can see in sources)
gives linker warning "pm_chain_head undefined",since register_pm_notifier is
"static inline" and expanded
to blocking_notifier_chain_unregister(&pm_chain_head, nb).
Why do you say pm_chain_head is static there ? Is it because it is not
exported by EXPORT_SYMBOL ?
So what does it have to do with the license ( which is already GPL, but I
just do not understand ).
What should be my choices, if I want to stay within distro kernel.
Thanks a lot.



On Feb 19, 2008 5:53 PM, Kyle McMartin <[EMAIL PROTECTED]> wrote:

>  On Tue, Feb 19, 2008 at 01:41:15PM +0200, Eugene Goubine wrote:
> > Hello , dear list users.
> > >From my module I am trying to register for the system suspend using the
> *
> > register_pm_notifier(nb)*
> > which is expanded to *blocking_notifier_chain_register(&pm_chain_head,
> nb).*
> > **
> > I have a linker warning which tells "pm_chain_head" is undefined. I do
> > see  pm_chain_head in my /proc/kallsyms.
> > What do I miss? Thank you.
>
> It's hard to comment on it if you don't attach the source code...
>
> At a guess, you tried using register_pm_notifier, that failed to link,
> so you tried to use the function that it calls, which won't work since
> pm_chain_head is static to the kernel/power/main.c compilation unit.
>
> License your module under the GPL and add MODULE_LICENSE("GPL") and
> you'll be able to use the register_pm_notifier export...
>
> regards, Kyle
>

MODULE_LICENSE("GPL"); 


static int pm_event(struct notifier_block *this, unsigned long event,void *ptr)
{

   
   return NOTIFY_OK;
}



static int netdev_event(struct notifier_block *this, unsigned long event,void 
*ptr)
{
   struct net_device *net_dev = (struct net_device *)ptr;
  
   DEBUGP_P1(DL_TRACE,"Device %s\n",net_dev->name);
   switch (event){

      case NETDEV_DOWN:
            DEBUGP(DL_TRACE,"NETDEV_DOWN\n");
            break;

      case  NETDEV_REGISTER:
            DEBUGP(DL_TRACE,"NETDEV_REGISTER\n");
            break;

      case  NETDEV_UP:
            DEBUGP(DL_TRACE,"NETDEV_UP\n");   
            break;

      case  NETDEV_CHANGE:
            DEBUGP(DL_TRACE,"NETDEV_CHANGE\n");
            break;

      case  NETDEV_UNREGISTER:
            DEBUGP(DL_TRACE,"NETDEV_UNREGISTER\n");
            break;
            
      default:
            DEBUGP(DL_TRACE,"Unknown netdev notification\n");
            break;
   }      
    
   return NOTIFY_OK;
}

struct notifier_block net_device_notifier = {
   .notifier_call = netdev_event
};



struct notifier_block powerm_notifier = {
   .notifier_call = pm_event
};




static int proto_init(void)
{  
   
   int i = 0;
   DEBUGP(DL_TRACE,"---->wibrouio_init\n");

   i = register_netdevice_notifier(&net_device_notifier); 


   // TODO: FIX THIS .DOES NOT WORK ! WHY? 
    //i = register_pm_notifier(&powerm_notifier);
  
   DEBUGP(DL_TRACE,"<----wibrouio_init\n");
   return 0;
  
}  

static void proto_exit(void)
{
   DEBUGP(DL_TRACE,"---->wibrouio_exit\n");
   unregister_netdevice_notifier(&net_device_notifier);

   // TODO: FIX THIS .DOES NOT WORK ! WHY? 
   //unregister_pm_notifier(&powerm_notifier);
   
   DEBUGP(DL_TRACE,"---->wibrouio_exit\n");
   
}

module_init(proto_init);
module_exit(proto_exit);

_______________________________________________
Fedora-kernel-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/fedora-kernel-list

Reply via email to