提交 2b00f54b 编写于 作者: H H Hartley Sweeten 提交者: Greg Kroah-Hartman

staging: comedi: ii_pci20kc: use comedi_alloc_spriv()

For aesthetic reasons, use the helper function to allocate the
subdevice private data instead of hanging it on the device
private data. The core will free the memory during the detach.
Signed-off-by: NH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 4f2cfd67
......@@ -149,9 +149,7 @@ union pci20xxx_subdev_private {
};
struct pci20xxx_private {
void __iomem *ioaddr;
union pci20xxx_subdev_private subdev_private[PCI20000_MODULES];
};
#define CHAN (CR_CHAN(it->chanlist[0]))
......@@ -222,9 +220,10 @@ static int pci20xxx_attach(struct comedi_device *dev,
for (i = 0; i < PCI20000_MODULES; i++) {
s = &dev->subdevices[i];
sdp = comedi_alloc_spriv(s, sizeof(*sdp));
if (!sdp)
return -ENOMEM;
id = readb(devpriv->ioaddr + (i + 1) * PCI20000_OFFSET);
s->private = devpriv->subdev_private + i;
sdp = s->private;
switch (id) {
case PCI20006_ID:
sdp->pci20006.iobase =
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册