llseek: automatically add .llseek fop
[sfrench/cifs-2.6.git] / arch / x86 / kernel / tlb_uv.c
index 59efb5390b37bec6d0de735c93483c35ba0ca43a..50ac949c7f1c5ee85381bd5ade1a37244a2f98d6 100644 (file)
@@ -1285,6 +1285,7 @@ static const struct file_operations tunables_fops = {
        .open           = tunables_open,
        .read           = tunables_read,
        .write          = tunables_write,
+       .llseek         = default_llseek,
 };
 
 static int __init uv_ptc_init(void)
@@ -1484,15 +1485,16 @@ calculate_destination_timeout(void)
 /*
  * initialize the bau_control structure for each cpu
  */
-static void uv_init_per_cpu(int nuvhubs)
+static void __init uv_init_per_cpu(int nuvhubs)
 {
        int i;
        int cpu;
        int pnode;
        int uvhub;
+       int have_hmaster;
        short socket = 0;
        unsigned short socket_mask;
-       unsigned int uvhub_mask;
+       unsigned char *uvhub_mask;
        struct bau_control *bcp;
        struct uvhub_desc *bdp;
        struct socket_desc *sdp;
@@ -1516,28 +1518,29 @@ static void uv_init_per_cpu(int nuvhubs)
        uvhub_descs = (struct uvhub_desc *)
                kmalloc(nuvhubs * sizeof(struct uvhub_desc), GFP_KERNEL);
        memset(uvhub_descs, 0, nuvhubs * sizeof(struct uvhub_desc));
+       uvhub_mask = kzalloc((nuvhubs+7)/8, GFP_KERNEL);
        for_each_present_cpu(cpu) {
                bcp = &per_cpu(bau_control, cpu);
                memset(bcp, 0, sizeof(struct bau_control));
                pnode = uv_cpu_hub_info(cpu)->pnode;
                uvhub = uv_cpu_hub_info(cpu)->numa_blade_id;
-               uvhub_mask |= (1 << uvhub);
+               *(uvhub_mask + (uvhub/8)) |= (1 << (uvhub%8));
                bdp = &uvhub_descs[uvhub];
                bdp->num_cpus++;
                bdp->uvhub = uvhub;
                bdp->pnode = pnode;
                /* kludge: 'assuming' one node per socket, and assuming that
                   disabling a socket just leaves a gap in node numbers */
-               socket = (cpu_to_node(cpu) & 1);;
+               socket = (cpu_to_node(cpu) & 1);
                bdp->socket_mask |= (1 << socket);
                sdp = &bdp->socket[socket];
                sdp->cpu_number[sdp->num_cpus] = cpu;
                sdp->num_cpus++;
        }
-       uvhub = 0;
-       while (uvhub_mask) {
-               if (!(uvhub_mask & 1))
-                       goto nexthub;
+       for (uvhub = 0; uvhub < nuvhubs; uvhub++) {
+               if (!(*(uvhub_mask + (uvhub/8)) & (1 << (uvhub%8))))
+                       continue;
+               have_hmaster = 0;
                bdp = &uvhub_descs[uvhub];
                socket_mask = bdp->socket_mask;
                socket = 0;
@@ -1551,8 +1554,10 @@ static void uv_init_per_cpu(int nuvhubs)
                                bcp->cpu = cpu;
                                if (i == 0) {
                                        smaster = bcp;
-                                       if (socket == 0)
+                                       if (!have_hmaster) {
+                                               have_hmaster++;
                                                hmaster = bcp;
+                                       }
                                }
                                bcp->cpus_in_uvhub = bdp->num_cpus;
                                bcp->cpus_in_socket = sdp->num_cpus;
@@ -1566,11 +1571,9 @@ nextsocket:
                        socket++;
                        socket_mask = (socket_mask >> 1);
                }
-nexthub:
-               uvhub++;
-               uvhub_mask = (uvhub_mask >> 1);
        }
        kfree(uvhub_descs);
+       kfree(uvhub_mask);
        for_each_present_cpu(cpu) {
                bcp = &per_cpu(bau_control, cpu);
                bcp->baudisabled = 0;