~ubuntu-branches/ubuntu/saucy/linux-ti-omap4/saucy-proposed

« back to all changes in this revision

Viewing changes to drivers/input/serio/xilinx_ps2.c

  • Committer: Package Import Robot
  • Author(s): Paolo Pisati, Paolo Pisati, Stefan Bader, Upstream Kernel Changes
  • Date: 2012-08-15 17:17:43 UTC
  • Revision ID: package-import@ubuntu.com-20120815171743-h5wnuf51xe7pvdid
Tags: 3.5.0-207.13
[ Paolo Pisati ]

* Start new release

[ Stefan Bader ]

* (config) Enable getabis to use local package copies

[ Upstream Kernel Changes ]

* fixup: gargabe collect iva_seq[0|1] init
* [Config] enable all SND_OMAP_SOC_*s
* fixup: cm2xxx_3xxx.o is needed for omap2_cm_read|write_reg
* fixup: add some snd_soc_dai* helper functions
* fixup: s/snd_soc_dpcm_params/snd_soc_dpcm/g
* fixup: typo, no_host_mode and useless SDP4430 init
* fixup: enable again aess hwmod

Show diffs side-by-side

added added

removed removed

Lines of Context:
73
73
        spinlock_t lock;
74
74
        void __iomem *base_address;     /* virt. address of control registers */
75
75
        unsigned int flags;
76
 
        struct serio serio;             /* serio */
 
76
        struct serio *serio;            /* serio */
 
77
        struct device *dev;
77
78
};
78
79
 
79
80
/************************************/
119
120
 
120
121
        /* Check which interrupt is active */
121
122
        if (intr_sr & XPS2_IPIXR_RX_OVF)
122
 
                dev_warn(drvdata->serio.dev.parent, "receive overrun error\n");
 
123
                dev_warn(drvdata->dev, "receive overrun error\n");
123
124
 
124
125
        if (intr_sr & XPS2_IPIXR_RX_ERR)
125
126
                drvdata->flags |= SERIO_PARITY;
132
133
 
133
134
                /* Error, if a byte is not received */
134
135
                if (status) {
135
 
                        dev_err(drvdata->serio.dev.parent,
 
136
                        dev_err(drvdata->dev,
136
137
                                "wrong rcvd byte count (%d)\n", status);
137
138
                } else {
138
 
                        serio_interrupt(&drvdata->serio, c, drvdata->flags);
 
139
                        serio_interrupt(drvdata->serio, c, drvdata->flags);
139
140
                        drvdata->flags = 0;
140
141
                }
141
142
        }
193
194
        error = request_irq(drvdata->irq, &xps2_interrupt, 0,
194
195
                                DRIVER_NAME, drvdata);
195
196
        if (error) {
196
 
                dev_err(drvdata->serio.dev.parent,
 
197
                dev_err(drvdata->dev,
197
198
                        "Couldn't allocate interrupt %d\n", drvdata->irq);
198
199
                return error;
199
200
        }
259
260
        }
260
261
 
261
262
        drvdata = kzalloc(sizeof(struct xps2data), GFP_KERNEL);
262
 
        if (!drvdata) {
263
 
                dev_err(dev, "Couldn't allocate device private record\n");
264
 
                return -ENOMEM;
 
263
        serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
 
264
        if (!drvdata || !serio) {
 
265
                error = -ENOMEM;
 
266
                goto failed1;
265
267
        }
266
268
 
267
 
        dev_set_drvdata(dev, drvdata);
268
 
 
269
269
        spin_lock_init(&drvdata->lock);
270
270
        drvdata->irq = r_irq.start;
 
271
        drvdata->serio = serio;
 
272
        drvdata->dev = dev;
271
273
 
272
274
        phys_addr = r_mem.start;
273
275
        remap_size = resource_size(&r_mem);
298
300
                 (unsigned long long)phys_addr, drvdata->base_address,
299
301
                 drvdata->irq);
300
302
 
301
 
        serio = &drvdata->serio;
302
303
        serio->id.type = SERIO_8042;
303
304
        serio->write = sxps2_write;
304
305
        serio->open = sxps2_open;
312
313
 
313
314
        serio_register_port(serio);
314
315
 
 
316
        platform_set_drvdata(ofdev, drvdata);
315
317
        return 0;               /* success */
316
318
 
317
319
failed2:
318
320
        release_mem_region(phys_addr, remap_size);
319
321
failed1:
 
322
        kfree(serio);
320
323
        kfree(drvdata);
321
 
        dev_set_drvdata(dev, NULL);
322
324
 
323
325
        return error;
324
326
}
333
335
 */
334
336
static int __devexit xps2_of_remove(struct platform_device *of_dev)
335
337
{
336
 
        struct device *dev = &of_dev->dev;
337
 
        struct xps2data *drvdata = dev_get_drvdata(dev);
 
338
        struct xps2data *drvdata = platform_get_drvdata(of_dev);
338
339
        struct resource r_mem; /* IO mem resources */
339
340
 
340
 
        serio_unregister_port(&drvdata->serio);
 
341
        serio_unregister_port(drvdata->serio);
341
342
        iounmap(drvdata->base_address);
342
343
 
343
344
        /* Get iospace of the device */
344
345
        if (of_address_to_resource(of_dev->dev.of_node, 0, &r_mem))
345
 
                dev_err(dev, "invalid address\n");
 
346
                dev_err(drvdata->dev, "invalid address\n");
346
347
        else
347
348
                release_mem_region(r_mem.start, resource_size(&r_mem));
348
349
 
349
350
        kfree(drvdata);
350
351
 
351
 
        dev_set_drvdata(dev, NULL);
 
352
        platform_set_drvdata(of_dev, NULL);
352
353
 
353
354
        return 0;
354
355
}