From mboxrd@z Thu Jan 1 00:00:00 1970 From: greg@kroah.com (Greg KH) Date: Tue, 20 Jun 2017 22:12:34 +0800 Subject: My network device don't work In-Reply-To: <186270325-26e3212af6540c227a34d3cd3b5e0c56@pmq3v.m5r2.onet> References: <186270325-26e3212af6540c227a34d3cd3b5e0c56@pmq3v.m5r2.onet> Message-ID: <20170620141234.GA2599@kroah.com> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org On Tue, Jun 20, 2017 at 02:32:31PM +0200, wiktoria.lewicka wrote: > Hello. > I write simple network device, but its don't work. Module is loading, loading, loading... > Code: > > #include > #include > #include > #include > #include > #define DEV_NAME "chwdp" > > struct net_device my_netdev; > > int init_my_net_dev(struct net_device *dev); > > struct net_device_ops nops = { > .ndo_init = init_my_net_dev, > //.ndo_uninit = uninit_my_net_dev, > }; > > static int __init init_dev(void) > { > //my_netdev.netdev_ops = &nops; > int result; > if((netdev_boot_setup_check(&my_netdev))){ > printk(KERN_ERR "NETDEV: setup error"); > return 0; Why are you returning success if there was an error? And always try to use proper kernel coding style when writing kernel code if you expect/want someone else to read it :) thanks, greg k-h