···11-/* drivers/atm/atmdev_init.c - ATM device driver initialization */22-33-/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */44-55-66-#include <linux/config.h>77-#include <linux/init.h>88-99-1010-#ifdef CONFIG_ATM_ZATM1111-extern int zatm_detect(void);1212-#endif1313-#ifdef CONFIG_ATM_AMBASSADOR1414-extern int amb_detect(void);1515-#endif1616-#ifdef CONFIG_ATM_HORIZON1717-extern int hrz_detect(void);1818-#endif1919-#ifdef CONFIG_ATM_FORE200E2020-extern int fore200e_detect(void);2121-#endif2222-#ifdef CONFIG_ATM_LANAI2323-extern int lanai_detect(void);2424-#endif2525-2626-2727-/*2828- * For historical reasons, atmdev_init returns the number of devices found.2929- * Note that some detections may not go via atmdev_init (e.g. eni.c), so this3030- * number is meaningless.3131- */3232-3333-int __init atmdev_init(void)3434-{3535- int devs;3636-3737- devs = 0;3838-#ifdef CONFIG_ATM_ZATM3939- devs += zatm_detect();4040-#endif4141-#ifdef CONFIG_ATM_AMBASSADOR4242- devs += amb_detect();4343-#endif4444-#ifdef CONFIG_ATM_HORIZON4545- devs += hrz_detect();4646-#endif4747-#ifdef CONFIG_ATM_FORE200E4848- devs += fore200e_detect();4949-#endif5050-#ifdef CONFIG_ATM_LANAI5151- devs += lanai_detect();5252-#endif5353- return devs;5454-}
···3939 * o lanai_change_qos() isn't written yet4040 *4141 * o There aren't any ioctl's yet -- I'd like to eventually support4242- * setting loopback and LED modes that way. (see lanai_ioctl)4242+ * setting loopback and LED modes that way.4343 *4444 * o If the segmentation engine or DMA gets shut down we should restart4545 * card as per section 17.0i. (see lanai_reset)···305305 * vci with their bit set306306 */307307static void vci_bitfield_iterate(struct lanai_dev *lanai,308308- /*const*/ unsigned long *lp,308308+ const unsigned long *lp,309309 void (*func)(struct lanai_dev *,vci_t vci))310310{311311 vci_t vci = find_first_bit(lp, NUM_VCI);···951951/* read a big-endian 4-byte value out of eeprom */952952static inline u32 eeprom_be4(const struct lanai_dev *lanai, int address)953953{954954- return be32_to_cpup((u32 *) (&lanai->eeprom[address]));954954+ return be32_to_cpup((const u32 *) &lanai->eeprom[address]);955955}956956957957/* Checksum/validate EEPROM contents */···11601160}1161116111621162/* test if VCC is currently backlogged */11631163-static inline int vcc_is_backlogged(/*const*/ struct lanai_vcc *lvcc)11631163+static inline int vcc_is_backlogged(const struct lanai_vcc *lvcc)11641164{11651165 return !skb_queue_empty(&lvcc->tx.backlog);11661166}···13951395{13961396 int size;13971397 struct sk_buff *skb;13981398- /*const*/ u32 *x, *end = &lvcc->rx.buf.start[endptr * 4];13981398+ const u32 *x;13991399+ u32 *end = &lvcc->rx.buf.start[endptr * 4];13991400 int n = ((unsigned long) end) - ((unsigned long) lvcc->rx.buf.ptr);14001401 if (n < 0)14011402 n += lanai_buf_size(&lvcc->rx.buf);···21122111 * shifted by that much as we compute21132112 *21142113 */21152115-static int pcr_to_cbricg(/*const*/ struct atm_qos *qos)21142114+static int pcr_to_cbricg(const struct atm_qos *qos)21162115{21172116 int rounddown = 0; /* 1 = Round PCR down, i.e. round ICG _up_ */21182117 int x, icg, pcr = atm_pcr_goal(&qos->txtp);···24352434 return result;24362435}2437243624382438-#if 024392439-/* ioctl operations for card */24402440-/* NOTE: these are all DEBUGGING ONLY currently */24412441-static int lanai_ioctl(struct atm_dev *atmdev, unsigned int cmd, void __user *arg)24422442-{24432443- int result = 0;24442444- struct lanai_dev *lanai = (struct lanai_dev *) atmdev->dev_data;24452445- switch(cmd) {24462446- case 2106275:24472447- shutdown_atm_dev(atmdev);24482448- return 0;24492449- case 2200000: {24502450- unsigned long flags;24512451- spin_lock_irqsave(&lanai->servicelock, flags);24522452- run_service(lanai);24532453- spin_unlock_irqrestore(&lanai->servicelock, flags);24542454- return 0; }24552455- case 2200002:24562456- get_statistics(lanai);24572457- return 0;24582458- case 2200003: {24592459- unsigned int i;24602460- for (i = 0; i <= 0x5C ; i += 4) {24612461- if (i==0x48) /* Write-only butt reg */24622462- continue;24632463- printk(KERN_CRIT DEV_LABEL " 0x%02X: "24642464- "0x%08X\n", i,24652465- (unsigned int) readl(lanai->base + i));24662466- barrier(); mb();24672467- pcistatus_check(lanai, 0);24682468- barrier(); mb();24692469- }24702470- return 0; }24712471- case 2200004: {24722472- u8 b;24732473- u16 w;24742474- u32 dw;24752475- struct pci_dev *pci = lanai->pci;24762476- (void) pci_read_config_word(pci, PCI_VENDOR_ID, &w);24772477- DPRINTK("vendor = 0x%X\n", (unsigned int) w);24782478- (void) pci_read_config_word(pci, PCI_DEVICE_ID, &w);24792479- DPRINTK("device = 0x%X\n", (unsigned int) w);24802480- (void) pci_read_config_word(pci, PCI_COMMAND, &w);24812481- DPRINTK("command = 0x%X\n", (unsigned int) w);24822482- (void) pci_read_config_word(pci, PCI_STATUS, &w);24832483- DPRINTK("status = 0x%X\n", (unsigned int) w);24842484- (void) pci_read_config_dword(pci,24852485- PCI_CLASS_REVISION, &dw);24862486- DPRINTK("class/revision = 0x%X\n", (unsigned int) dw);24872487- (void) pci_read_config_byte(pci,24882488- PCI_CACHE_LINE_SIZE, &b);24892489- DPRINTK("cache line size = 0x%X\n", (unsigned int) b);24902490- (void) pci_read_config_byte(pci, PCI_LATENCY_TIMER, &b);24912491- DPRINTK("latency = %d (0x%X)\n",24922492- (int) b, (unsigned int) b);24932493- (void) pci_read_config_byte(pci, PCI_HEADER_TYPE, &b);24942494- DPRINTK("header type = 0x%X\n", (unsigned int) b);24952495- (void) pci_read_config_byte(pci, PCI_BIST, &b);24962496- DPRINTK("bist = 0x%X\n", (unsigned int) b);24972497- /* skipping a few here */24982498- (void) pci_read_config_byte(pci,24992499- PCI_INTERRUPT_LINE, &b);25002500- DPRINTK("pci_int_line = 0x%X\n", (unsigned int) b);25012501- (void) pci_read_config_byte(pci,25022502- PCI_INTERRUPT_PIN, &b);25032503- DPRINTK("pci_int_pin = 0x%X\n", (unsigned int) b);25042504- (void) pci_read_config_byte(pci, PCI_MIN_GNT, &b);25052505- DPRINTK("min_gnt = 0x%X\n", (unsigned int) b);25062506- (void) pci_read_config_byte(pci, PCI_MAX_LAT, &b);25072507- DPRINTK("max_lat = 0x%X\n", (unsigned int) b); }25082508- return 0;25092509-#ifdef USE_POWERDOWN25102510- case 2200005:25112511- DPRINTK("Coming out of powerdown\n");25122512- lanai->conf1 &= ~CONFIG1_POWERDOWN;25132513- conf1_write(lanai);25142514- return 0;25152515-#endif25162516- default:25172517- result = -ENOIOCTLCMD;25182518- }25192519- return result;25202520-}25212521-#else /* !0 */25222522-#define lanai_ioctl NULL25232523-#endif /* 0 */25242524-25252437static int lanai_send(struct atm_vcc *atmvcc, struct sk_buff *skb)25262438{25272439 struct lanai_vcc *lvcc = (struct lanai_vcc *) atmvcc->dev_data;···25922678 .dev_close = lanai_dev_close,25932679 .open = lanai_open,25942680 .close = lanai_close,25952595- .ioctl = lanai_ioctl,25962681 .getsockopt = NULL,25972682 .setsockopt = NULL,25982683 .send = lanai_send,···26732760 * gone, so there isn't much to do26742761 */26752762 DPRINTK("cleanup_module()\n");27632763+ pci_unregister_driver(&lanai_driver);26762764}2677276526782766module_init(lanai_module_init);
+2-2
drivers/usb/atm/usbatm.c
···879879880880 fail:881881 instance->atm_dev = NULL;882882- shutdown_atm_dev(atm_dev); /* usbatm_atm_dev_close will eventually be called */882882+ atm_dev_deregister(atm_dev); /* usbatm_atm_dev_close will eventually be called */883883 return ret;884884}885885···1164116411651165 /* ATM finalize */11661166 if (instance->atm_dev)11671167- shutdown_atm_dev(instance->atm_dev);11671167+ atm_dev_deregister(instance->atm_dev);1168116811691169 usbatm_put_instance(instance); /* taken in usbatm_usb_probe */11701170}
+9-9
include/linux/atmdev.h
···77#define LINUX_ATMDEV_H88991010-#include <linux/config.h>1110#include <linux/atmapi.h>1211#include <linux/atm.h>1312#include <linux/atmioc.h>···209210210211#ifdef __KERNEL__211212213213+#include <linux/config.h>212214#include <linux/wait.h> /* wait_queue_head_t */213215#include <linux/time.h> /* struct timeval */214216#include <linux/net.h>···274274275275276276enum {277277- ATM_DF_CLOSE, /* close device when last VCC is closed */277277+ ATM_DF_REMOVED, /* device was removed from atm_devs list */278278};279279280280···415415 int number,unsigned long *flags); /* number == -1: pick first available */416416struct atm_dev *atm_dev_lookup(int number);417417void atm_dev_deregister(struct atm_dev *dev);418418-void shutdown_atm_dev(struct atm_dev *dev);419418void vcc_insert_socket(struct sock *sk);420419421420···456457457458static inline void atm_dev_put(struct atm_dev *dev)458459{459459- atomic_dec(&dev->refcnt);460460-461461- if ((atomic_read(&dev->refcnt) == 1) &&462462- test_bit(ATM_DF_CLOSE,&dev->flags))463463- shutdown_atm_dev(dev);460460+ if (atomic_dec_and_test(&dev->refcnt)) {461461+ BUG_ON(!test_bit(ATM_DF_REMOVED, &dev->flags));462462+ if (dev->ops->dev_close)463463+ dev->ops->dev_close(dev);464464+ kfree(dev);465465+ }464466}465467466468467469int atm_charge(struct atm_vcc *vcc,int truesize);468470struct sk_buff *atm_alloc_charge(struct atm_vcc *vcc,int pdu_size,469471 gfp_t gfp_flags);470470-int atm_pcr_goal(struct atm_trafprm *tp);472472+int atm_pcr_goal(const struct atm_trafprm *tp);471473472474void vcc_release_async(struct atm_vcc *vcc, int reply);473475
+7-4
net/atm/atm_misc.c
···7474 */757576767777-int atm_pcr_goal(struct atm_trafprm *tp)7777+int atm_pcr_goal(const struct atm_trafprm *tp)7878{7979- if (tp->pcr && tp->pcr != ATM_MAX_PCR) return -tp->pcr;8080- if (tp->min_pcr && !tp->pcr) return tp->min_pcr;8181- if (tp->max_pcr != ATM_MAX_PCR) return -tp->max_pcr;7979+ if (tp->pcr && tp->pcr != ATM_MAX_PCR)8080+ return -tp->pcr;8181+ if (tp->min_pcr && !tp->pcr)8282+ return tp->min_pcr;8383+ if (tp->max_pcr != ATM_MAX_PCR)8484+ return -tp->max_pcr;8285 return 0;8386}8487
+40-26
net/atm/common.c
···221221EXPORT_SYMBOL(vcc_release_async);222222223223224224+void atm_dev_release_vccs(struct atm_dev *dev)225225+{226226+ int i;227227+228228+ write_lock_irq(&vcc_sklist_lock);229229+ for (i = 0; i < VCC_HTABLE_SIZE; i++) {230230+ struct hlist_head *head = &vcc_hash[i];231231+ struct hlist_node *node, *tmp;232232+ struct sock *s;233233+ struct atm_vcc *vcc;234234+235235+ sk_for_each_safe(s, node, tmp, head) {236236+ vcc = atm_sk(s);237237+ if (vcc->dev == dev) {238238+ vcc_release_async(vcc, -EPIPE);239239+ sk_del_node_init(s);240240+ }241241+ }242242+ }243243+ write_unlock_irq(&vcc_sklist_lock);244244+}245245+246246+224247static int adjust_tp(struct atm_trafprm *tp,unsigned char aal)225248{226249 int max_sdu;···355332 return -EINVAL;356333 if (vci > 0 && vci < ATM_NOT_RSV_VCI && !capable(CAP_NET_BIND_SERVICE))357334 return -EPERM;358358- error = 0;335335+ error = -ENODEV;359336 if (!try_module_get(dev->ops->owner))360360- return -ENODEV;337337+ return error;361338 vcc->dev = dev;362339 write_lock_irq(&vcc_sklist_lock);363363- if ((error = find_ci(vcc, &vpi, &vci))) {340340+ if (test_bit(ATM_DF_REMOVED, &dev->flags) || 341341+ (error = find_ci(vcc, &vpi, &vci))) {364342 write_unlock_irq(&vcc_sklist_lock);365343 goto fail_module_put;366344 }···447423 if (vcc->qos.txtp.traffic_class == ATM_ANYCLASS ||448424 vcc->qos.rxtp.traffic_class == ATM_ANYCLASS)449425 return -EINVAL;450450- if (itf != ATM_ITF_ANY) {451451- dev = atm_dev_lookup(itf);452452- if (!dev)453453- return -ENODEV;454454- error = __vcc_connect(vcc, dev, vpi, vci);455455- if (error) {456456- atm_dev_put(dev);457457- return error;458458- }426426+ if (likely(itf != ATM_ITF_ANY)) {427427+ dev = try_then_request_module(atm_dev_lookup(itf), "atm-device-%d", itf);459428 } else {460460- struct list_head *p, *next;461461-462429 dev = NULL;463463- spin_lock(&atm_dev_lock);464464- list_for_each_safe(p, next, &atm_devs) {465465- dev = list_entry(p, struct atm_dev, dev_list);430430+ down(&atm_dev_mutex);431431+ if (!list_empty(&atm_devs)) {432432+ dev = list_entry(atm_devs.next, struct atm_dev, dev_list);466433 atm_dev_hold(dev);467467- spin_unlock(&atm_dev_lock);468468- if (!__vcc_connect(vcc, dev, vpi, vci))469469- break;470470- atm_dev_put(dev);471471- dev = NULL;472472- spin_lock(&atm_dev_lock);473434 }474474- spin_unlock(&atm_dev_lock);475475- if (!dev)476476- return -ENODEV;435435+ up(&atm_dev_mutex);436436+ }437437+ if (!dev)438438+ return -ENODEV;439439+ error = __vcc_connect(vcc, dev, vpi, vci);440440+ if (error) {441441+ atm_dev_put(dev);442442+ return error;477443 }478444 if (vpi == ATM_VPI_UNSPEC || vci == ATM_VCI_UNSPEC)479445 set_bit(ATM_VF_PARTIAL,&vcc->flags);
···220220 short error; /* This ICMP is classed as an error message */221221};222222223223-static struct icmp_control icmp_pointers[NR_ICMP_TYPES+1];223223+static const struct icmp_control icmp_pointers[NR_ICMP_TYPES+1];224224225225/*226226 * The ICMP socket(s). This is the most convenient way to flow control···994994/*995995 * This table is the definition of how we handle ICMP.996996 */997997-static struct icmp_control icmp_pointers[NR_ICMP_TYPES + 1] = {997997+static const struct icmp_control icmp_pointers[NR_ICMP_TYPES + 1] = {998998 [ICMP_ECHOREPLY] = {999999 .output_entry = ICMP_MIB_OUTECHOREPS,10001000 .input_entry = ICMP_MIB_INECHOREPS,
···690690 return csum;691691}692692693693-inline int ip_ufo_append_data(struct sock *sk,693693+static inline int ip_ufo_append_data(struct sock *sk,694694 int getfrag(void *from, char *to, int offset, int len,695695 int odd, struct sk_buff *skb),696696 void *from, int length, int hh_len, int fragheaderlen,
+1-1
net/ipv4/ipvs/ip_vs_conn.c
···771771 * The drop rate array needs tuning for real environments.772772 * Called from timer bh only => no locking773773 */774774- static char todrop_rate[9] = {0, 1, 2, 3, 4, 5, 6, 7, 8};774774+ static const char todrop_rate[9] = {0, 1, 2, 3, 4, 5, 6, 7, 8};775775 static char todrop_counter[9] = {0};776776 int i;777777
···3737module_param(master_timeout, int, 0600);3838MODULE_PARM_DESC(master_timeout, "timeout for the master connection");39394040-static char *conns[] = { "DATA ", "MESG ", "INDEX " };4040+static const char *conns[] = { "DATA ", "MESG ", "INDEX " };41414242/* This is slow, but it's simple. --RR */4343static char *amanda_buffer;
+2-2
net/ipv4/netfilter/ip_conntrack_core.c
···13541354 get_order(sizeof(struct list_head) * size));13551355}1356135613571357-void ip_conntrack_flush()13571357+void ip_conntrack_flush(void)13581358{13591359 /* This makes sure all current packets have passed through13601360 netfilter framework. Roll on, two-stage module···14081408 return hash;14091409}1410141014111411-int set_hashsize(const char *val, struct kernel_param *kp)14111411+static int set_hashsize(const char *val, struct kernel_param *kp)14121412{14131413 int i, bucket, hashsize, vmalloced;14141414 int old_vmalloced, old_size;
···751751 inet6_del_protocol(&icmpv6_protocol, IPPROTO_ICMPV6);752752}753753754754-static struct icmp6_err {754754+static const struct icmp6_err {755755 int err;756756 int fatal;757757} tab_unreach[] = {
+2-1
net/ipv6/ip6_output.c
···774774 *dst = NULL;775775 return err;776776}777777-inline int ip6_ufo_append_data(struct sock *sk,777777+778778+static inline int ip6_ufo_append_data(struct sock *sk,778779 int getfrag(void *from, char *to, int offset, int len,779780 int odd, struct sk_buff *skb),780781 void *from, int length, int hh_len, int fragheaderlen,
+2-2
net/ipv6/ipv6_sockglue.c
···628628 return -EINVAL;629629}630630631631-int ipv6_getsockopt_sticky(struct sock *sk, struct ipv6_opt_hdr *hdr,632632- char __user *optval, int len)631631+static int ipv6_getsockopt_sticky(struct sock *sk, struct ipv6_opt_hdr *hdr,632632+ char __user *optval, int len)633633{634634 if (!hdr)635635 return 0;