本文整理汇总了C++中dev_info函数的典型用法代码示例。如果您正苦于以下问题:C++ dev_info函数的具体用法?C++ dev_info怎么用?C++ dev_info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dev_info函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: iommu_map_sg
int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
struct scatterlist *sglist, int nelems,
unsigned long mask, enum dma_data_direction direction,
struct dma_attrs *attrs)
{
dma_addr_t dma_next = 0, dma_addr;
unsigned long flags;
struct scatterlist *s, *outs, *segstart;
int outcount, incount, i, build_fail = 0;
unsigned int align;
unsigned long handle;
unsigned int max_seg_size;
BUG_ON(direction == DMA_NONE);
if ((nelems == 0) || !tbl)
return 0;
outs = s = segstart = &sglist[0];
outcount = 1;
incount = nelems;
handle = 0;
/* Init first segment length for backout at failure */
outs->dma_length = 0;
DBG("sg mapping %d elements:\n", nelems);
spin_lock_irqsave(&(tbl->it_lock), flags);
max_seg_size = dma_get_max_seg_size(dev);
for_each_sg(sglist, s, nelems, i) {
unsigned long vaddr, npages, entry, slen;
slen = s->length;
/* Sanity check */
if (slen == 0) {
dma_next = 0;
continue;
}
/* Allocate iommu entries for that segment */
vaddr = (unsigned long) sg_virt(s);
npages = iommu_num_pages(vaddr, slen, IOMMU_PAGE_SIZE);
align = 0;
if (IOMMU_PAGE_SHIFT < PAGE_SHIFT && slen >= PAGE_SIZE &&
(vaddr & ~PAGE_MASK) == 0)
align = PAGE_SHIFT - IOMMU_PAGE_SHIFT;
entry = iommu_range_alloc(dev, tbl, npages, &handle,
mask >> IOMMU_PAGE_SHIFT, align);
DBG(" - vaddr: %lx, size: %lx\n", vaddr, slen);
/* Handle failure */
if (unlikely(entry == DMA_ERROR_CODE)) {
if (printk_ratelimit())
dev_info(dev, "iommu_alloc failed, tbl %p "
"vaddr %lx npages %lu\n", tbl, vaddr,
npages);
goto failure;
}
/* Convert entry to a dma_addr_t */
entry += tbl->it_offset;
dma_addr = entry << IOMMU_PAGE_SHIFT;
dma_addr |= (s->offset & ~IOMMU_PAGE_MASK);
DBG(" - %lu pages, entry: %lx, dma_addr: %lx\n",
npages, entry, dma_addr);
/* Insert into HW table */
build_fail = ppc_md.tce_build(tbl, entry, npages,
vaddr & IOMMU_PAGE_MASK,
direction, attrs);
if(unlikely(build_fail))
goto failure;
/* If we are in an open segment, try merging */
if (segstart != s) {
DBG(" - trying merge...\n");
/* We cannot merge if:
* - allocated dma_addr isn't contiguous to previous allocation
*/
if (novmerge || (dma_addr != dma_next) ||
(outs->dma_length + s->length > max_seg_size)) {
/* Can't merge: create a new segment */
segstart = s;
outcount++;
outs = sg_next(outs);
DBG(" can't merge, new segment.\n");
} else {
outs->dma_length += s->length;
DBG(" merged, new len: %ux\n", outs->dma_length);
}
}
if (segstart == s) {
/* This is a new segment, fill entries */
DBG(" - filling new segment.\n");
outs->dma_address = dma_addr;
outs->dma_length = slen;
//.........这里部分代码省略.........
开发者ID:0xroot,项目名称:Blackphone-BP1-Kernel,代码行数:101,代码来源:iommu.c
示例2: cypress_probe
//.........这里部分代码省略.........
(endpoint->bEndpointAddress & USB_DIR_IN) &&
((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_BULK) )
{
/* we found a bulk in endpoint */
buffer_size = endpoint->wMaxPacketSize;
dev->bulk_in_size = buffer_size;
dev->bulk_in_endpointAddr = endpoint->bEndpointAddress;
dev->read_urb = usb_alloc_urb(0, GFP_ATOMIC);
if( dev->read_urb == NULL )
{
printk("No free urbs available");
goto error;
}
dev->read_urb->transfer_flags = (URB_NO_TRANSFER_DMA_MAP);
dev->bulk_in_buffer = usb_alloc_coherent (udev,
buffer_size, GFP_ATOMIC,
&dev->read_urb->transfer_dma);
if( dev->bulk_in_buffer == NULL )
{
printk("Couldn't allocate bulk_in_buffer");
goto error;
}
usb_fill_bulk_urb(dev->read_urb, udev,
usb_rcvbulkpipe(udev, endpoint->bEndpointAddress),
dev->bulk_in_buffer, buffer_size,
(usb_complete_t)cypress_read_bulk_callback, dev);
}
if( !dev->bulk_out_endpointAddr &&
!(endpoint->bEndpointAddress & USB_DIR_IN) &&
((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_BULK) )
{
/* we found a bulk out endpoint */
/* a probe() may sleep and has no restrictions on memory allocations */
dev->write_urb = usb_alloc_urb(0, GFP_ATOMIC);
if( dev->write_urb == NULL )
{
printk("No free urbs available");
goto error;
}
dev->bulk_out_endpointAddr = endpoint->bEndpointAddress;
/* on some platforms using this kind of buffer alloc
* call eliminates a dma "bounce buffer".
*
* NOTE: you'd normally want i/o buffers that hold
* more than one packet, so that i/o delays between
* packets don't hurt throughput.
*/
buffer_size = endpoint->wMaxPacketSize;
dev->bulk_out_size = buffer_size;
dev->write_urb->transfer_flags = (URB_NO_TRANSFER_DMA_MAP);
dev->bulk_out_buffer = usb_alloc_coherent (udev,
buffer_size, GFP_ATOMIC,
&dev->write_urb->transfer_dma);
if( dev->bulk_out_buffer == NULL )
{
printk("Couldn't allocate bulk_out_buffer");
goto error;
}
usb_fill_bulk_urb(dev->write_urb, udev,
usb_sndbulkpipe(udev,
endpoint->bEndpointAddress),
dev->bulk_out_buffer, buffer_size,
(usb_complete_t)cypress_write_bulk_callback, dev);
}
}
if (!(dev->bulk_in_endpointAddr && dev->bulk_out_endpointAddr))
{
printk("Couldn't find both bulk-in and bulk-out endpoints");
goto error;
}
dev->present = 1; /* allow device read, write and ioctl */
usb_set_intfdata (interface, dev); /* we can register the device now, as it is ready */
spin_lock_init(&(dev->lock)); /* initialize spinlock to unlocked (new kerenel method) */
/* HK: Begin- connect filesystem hooks */
/* we can register the device now, as it is ready */
retval = usb_register_dev(interface, &cypress_class);
if (retval) {
/* something prevented us from registering this driver */
printk("Not able to get a minor for this device.");
usb_set_intfdata(interface, NULL);
goto error;
}
dev_info(&interface->dev,
"BRL USB device now attached to minor: %d\n",
interface->minor); /* let the user know the device minor */
dev->read_task = NULL; /* Initialize fs read_task. */
addNode(dev);
return 0;
error: // please please please remove goto statements! HK:Why?
printk("cypress_probe: error occured!\n");
cypress_delete (dev);
return retval;
}
开发者ID:iitbombay,项目名称:usb-board-driver,代码行数:101,代码来源:bulk_cypress.c
示例3: receive_flow_control
/*
* Receive flow control
* Return 1 - If ok, else 0
*/
static int receive_flow_control(struct nozomi *dc)
{
enum port_type port = PORT_MDM;
struct ctrl_dl ctrl_dl;
struct ctrl_dl old_ctrl;
u16 enable_ier = 0;
read_mem32((u32 *) &ctrl_dl, dc->port[PORT_CTRL].dl_addr[CH_A], 2);
switch (ctrl_dl.port) {
case CTRL_CMD:
DBG1("The Base Band sends this value as a response to a "
"request for IMSI detach sent over the control "
"channel uplink (see section 7.6.1).");
break;
case CTRL_MDM:
port = PORT_MDM;
enable_ier = MDM_DL;
break;
case CTRL_DIAG:
port = PORT_DIAG;
enable_ier = DIAG_DL;
break;
case CTRL_APP1:
port = PORT_APP1;
enable_ier = APP1_DL;
break;
case CTRL_APP2:
port = PORT_APP2;
enable_ier = APP2_DL;
if (dc->state == NOZOMI_STATE_ALLOCATED) {
/*
* After card initialization the flow control
* received for APP2 is always the last
*/
dc->state = NOZOMI_STATE_READY;
dev_info(&dc->pdev->dev, "Device READY!\n");
}
break;
default:
dev_err(&dc->pdev->dev,
"ERROR: flow control received for non-existing port\n");
return 0;
}
DBG1("0x%04X->0x%04X", *((u16 *)&dc->port[port].ctrl_dl),
*((u16 *)&ctrl_dl));
old_ctrl = dc->port[port].ctrl_dl;
dc->port[port].ctrl_dl = ctrl_dl;
if (old_ctrl.CTS == 1 && ctrl_dl.CTS == 0) {
DBG1("Disable interrupt (0x%04X) on port: %d",
enable_ier, port);
disable_transmit_ul(port, dc);
} else if (old_ctrl.CTS == 0 && ctrl_dl.CTS == 1) {
if (kfifo_len(&dc->port[port].fifo_ul)) {
DBG1("Enable interrupt (0x%04X) on port: %d",
enable_ier, port);
DBG1("Data in buffer [%d], enable transmit! ",
kfifo_len(&dc->port[port].fifo_ul));
enable_transmit_ul(port, dc);
} else {
DBG1("No data in buffer...");
}
}
if (*(u16 *)&old_ctrl == *(u16 *)&ctrl_dl) {
DBG1(" No change in mctrl");
return 1;
}
/* Update statistics */
if (old_ctrl.CTS != ctrl_dl.CTS)
dc->port[port].tty_icount.cts++;
if (old_ctrl.DSR != ctrl_dl.DSR)
dc->port[port].tty_icount.dsr++;
if (old_ctrl.RI != ctrl_dl.RI)
dc->port[port].tty_icount.rng++;
if (old_ctrl.DCD != ctrl_dl.DCD)
dc->port[port].tty_icount.dcd++;
wake_up_interruptible(&dc->port[port].tty_wait);
DBG1("port: %d DCD(%d), CTS(%d), RI(%d), DSR(%d)",
port,
dc->port[port].tty_icount.dcd, dc->port[port].tty_icount.cts,
dc->port[port].tty_icount.rng, dc->port[port].tty_icount.dsr);
return 1;
}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:96,代码来源:nozomi.c
示例4: dvb_usbv2_probe
int dvb_usbv2_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
int ret;
struct dvb_usb_device *d;
struct usb_device *udev = interface_to_usbdev(intf);
struct dvb_usb_driver_info *driver_info =
(struct dvb_usb_driver_info *) id->driver_info;
dev_dbg(&udev->dev, "%s: bInterfaceNumber=%d\n", __func__,
intf->cur_altsetting->desc.bInterfaceNumber);
if (!id->driver_info) {
dev_err(&udev->dev, "%s: driver_info failed\n", KBUILD_MODNAME);
ret = -ENODEV;
goto err;
}
d = kzalloc(sizeof(struct dvb_usb_device), GFP_KERNEL);
if (!d) {
dev_err(&udev->dev, "%s: kzalloc() failed\n", KBUILD_MODNAME);
ret = -ENOMEM;
goto err;
}
d->name = driver_info->name;
d->rc_map = driver_info->rc_map;
d->udev = udev;
d->props = driver_info->props;
if (intf->cur_altsetting->desc.bInterfaceNumber !=
d->props->bInterfaceNumber) {
ret = -ENODEV;
goto err_free_all;
}
mutex_init(&d->usb_mutex);
mutex_init(&d->i2c_mutex);
if (d->props->size_of_priv) {
d->priv = kzalloc(d->props->size_of_priv, GFP_KERNEL);
if (!d->priv) {
dev_err(&d->udev->dev, "%s: kzalloc() failed\n",
KBUILD_MODNAME);
ret = -ENOMEM;
goto err_free_all;
}
}
if (d->props->identify_state) {
const char *name = NULL;
ret = d->props->identify_state(d, &name);
if (ret == 0) {
;
} else if (ret == COLD) {
dev_info(&d->udev->dev,
"%s: found a '%s' in cold state\n",
KBUILD_MODNAME, d->name);
if (!name)
name = d->props->firmware;
ret = dvb_usbv2_download_firmware(d, name);
if (ret == 0) {
/* device is warm, continue initialization */
;
} else if (ret == RECONNECTS_USB) {
/*
* USB core will call disconnect() and then
* probe() as device reconnects itself from the
* USB bus. disconnect() will release all driver
* resources and probe() is called for 'new'
* device. As 'new' device is warm we should
* never go here again.
*/
goto exit;
} else {
goto err_free_all;
}
} else {
goto err_free_all;
}
}
dev_info(&d->udev->dev, "%s: found a '%s' in warm state\n",
KBUILD_MODNAME, d->name);
ret = dvb_usbv2_init(d);
if (ret < 0)
goto err_free_all;
dev_info(&d->udev->dev,
"%s: '%s' successfully initialized and connected\n",
KBUILD_MODNAME, d->name);
exit:
usb_set_intfdata(intf, d);
return 0;
err_free_all:
dvb_usbv2_exit(d);
//.........这里部分代码省略.........
开发者ID:PDi-Communication-Systems-Inc,项目名称:lollipop_vendor_backports-3.19-rc1-1,代码行数:101,代码来源:dvb_usb_core.c
示例5: pil_modem_driver_probe
static int __devinit pil_modem_driver_probe(struct platform_device *pdev)
{
struct modem_data *drv;
struct resource *res;
struct pil_desc *desc;
int ret;
drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_KERNEL);
if (!drv)
return -ENOMEM;
platform_set_drvdata(pdev, drv);
drv->irq = platform_get_irq(pdev, 0);
if (drv->irq < 0)
return drv->irq;
drv->xo = devm_clk_get(&pdev->dev, "xo");
if (IS_ERR(drv->xo))
return PTR_ERR(drv->xo);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
drv->base = devm_request_and_ioremap(&pdev->dev, res);
if (!drv->base)
return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
drv->wdog = devm_request_and_ioremap(&pdev->dev, res);
if (!drv->wdog)
return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
if (!res)
return -EINVAL;
drv->cbase = devm_ioremap(&pdev->dev, res->start, resource_size(res));
if (!drv->cbase)
return -ENOMEM;
desc = &drv->pil_desc;
desc->name = "modem";
desc->dev = &pdev->dev;
desc->owner = THIS_MODULE;
desc->proxy_timeout = 10000;
if (pas_supported(PAS_MODEM) > 0) {
desc->ops = &pil_modem_ops_trusted;
dev_info(&pdev->dev, "using secure boot\n");
} else {
desc->ops = &pil_modem_ops;
dev_info(&pdev->dev, "using non-secure boot\n");
}
ret = pil_desc_init(desc);
if (ret)
return ret;
drv->notifier.notifier_call = modem_notif_handler,
ret = modem_register_notifier(&drv->notifier);
if (ret)
goto err_notify;
drv->subsys_desc.name = "modem";
drv->subsys_desc.depends_on = "adsp";
drv->subsys_desc.dev = &pdev->dev;
drv->subsys_desc.owner = THIS_MODULE;
drv->subsys_desc.start = modem_start;
drv->subsys_desc.stop = modem_stop;
drv->subsys_desc.shutdown = modem_shutdown;
drv->subsys_desc.powerup = modem_powerup;
drv->subsys_desc.ramdump = modem_ramdump;
drv->subsys_desc.crash_shutdown = modem_crash_shutdown;
INIT_WORK(&drv->fatal_work, modem_fatal_fn);
INIT_DELAYED_WORK(&drv->unlock_work, modem_unlock_timeout);
drv->subsys = subsys_register(&drv->subsys_desc);
if (IS_ERR(drv->subsys)) {
ret = PTR_ERR(drv->subsys);
goto err_subsys;
}
drv->ramdump_dev = create_ramdump_device("modem", &pdev->dev);
if (!drv->ramdump_dev) {
ret = -ENOMEM;
goto err_ramdump;
}
ret = devm_request_irq(&pdev->dev, drv->irq, modem_wdog_bite_irq,
IRQF_TRIGGER_RISING, "modem_watchdog", drv);
if (ret)
goto err_irq;
return 0;
err_irq:
destroy_ramdump_device(drv->ramdump_dev);
err_ramdump:
subsys_unregister(drv->subsys);
err_subsys:
modem_unregister_notifier(&drv->notifier);
err_notify:
pil_desc_release(desc);
//.........这里部分代码省略.........
开发者ID:1041574425,项目名称:Z5S_NX503A_130_kernel,代码行数:101,代码来源:pil-modem.c
示例6: dvb_usbv2_adapter_dvb_init
static int dvb_usbv2_adapter_dvb_init(struct dvb_usb_adapter *adap)
{
int ret;
struct dvb_usb_device *d = adap_to_d(adap);
dev_dbg(&d->udev->dev, "%s: adap=%d\n", __func__, adap->id);
ret = dvb_register_adapter(&adap->dvb_adap, d->name, d->props->owner,
&d->udev->dev, d->props->adapter_nr);
if (ret < 0) {
dev_dbg(&d->udev->dev, "%s: dvb_register_adapter() failed=%d\n",
__func__, ret);
goto err_dvb_register_adapter;
}
adap->dvb_adap.priv = adap;
if (d->props->read_mac_address) {
ret = d->props->read_mac_address(adap,
adap->dvb_adap.proposed_mac);
if (ret < 0)
goto err_dvb_dmx_init;
dev_info(&d->udev->dev, "%s: MAC address: %pM\n",
KBUILD_MODNAME, adap->dvb_adap.proposed_mac);
}
adap->demux.dmx.capabilities = DMX_TS_FILTERING | DMX_SECTION_FILTERING;
adap->demux.priv = adap;
adap->demux.filternum = 0;
adap->demux.filternum = adap->max_feed_count;
adap->demux.feednum = adap->demux.filternum;
adap->demux.start_feed = dvb_usb_start_feed;
adap->demux.stop_feed = dvb_usb_stop_feed;
adap->demux.write_to_decoder = NULL;
ret = dvb_dmx_init(&adap->demux);
if (ret < 0) {
dev_err(&d->udev->dev, "%s: dvb_dmx_init() failed=%d\n",
KBUILD_MODNAME, ret);
goto err_dvb_dmx_init;
}
adap->dmxdev.filternum = adap->demux.filternum;
adap->dmxdev.demux = &adap->demux.dmx;
adap->dmxdev.capabilities = 0;
ret = dvb_dmxdev_init(&adap->dmxdev, &adap->dvb_adap);
if (ret < 0) {
dev_err(&d->udev->dev, "%s: dvb_dmxdev_init() failed=%d\n",
KBUILD_MODNAME, ret);
goto err_dvb_dmxdev_init;
}
ret = dvb_net_init(&adap->dvb_adap, &adap->dvb_net, &adap->demux.dmx);
if (ret < 0) {
dev_err(&d->udev->dev, "%s: dvb_net_init() failed=%d\n",
KBUILD_MODNAME, ret);
goto err_dvb_net_init;
}
return 0;
err_dvb_net_init:
dvb_dmxdev_release(&adap->dmxdev);
err_dvb_dmxdev_init:
dvb_dmx_release(&adap->demux);
err_dvb_dmx_init:
dvb_unregister_adapter(&adap->dvb_adap);
err_dvb_register_adapter:
adap->dvb_adap.priv = NULL;
return ret;
}
开发者ID:PDi-Communication-Systems-Inc,项目名称:lollipop_vendor_backports-3.19-rc1-1,代码行数:69,代码来源:dvb_usb_core.c
示例7: sh_pfc_probe
static int sh_pfc_probe(struct platform_device *pdev)
{
const struct platform_device_id *platid = platform_get_device_id(pdev);
#ifdef CONFIG_OF
struct device_node *np = pdev->dev.of_node;
#endif
const struct sh_pfc_soc_info *info;
struct sh_pfc *pfc;
int ret;
#ifdef CONFIG_OF
if (np)
info = of_device_get_match_data(&pdev->dev);
else
#endif
info = platid ? (const void *)platid->driver_data : NULL;
if (info == NULL)
return -ENODEV;
pfc = devm_kzalloc(&pdev->dev, sizeof(*pfc), GFP_KERNEL);
if (pfc == NULL)
return -ENOMEM;
pfc->info = info;
pfc->dev = &pdev->dev;
ret = sh_pfc_map_resources(pfc, pdev);
if (unlikely(ret < 0))
return ret;
spin_lock_init(&pfc->lock);
if (info->ops && info->ops->init) {
ret = info->ops->init(pfc);
if (ret < 0)
return ret;
}
pinctrl_provide_dummies();
ret = sh_pfc_init_ranges(pfc);
if (ret < 0)
return ret;
/*
* Initialize pinctrl bindings first
*/
ret = sh_pfc_register_pinctrl(pfc);
if (unlikely(ret != 0))
return ret;
#ifdef CONFIG_PINCTRL_SH_PFC_GPIO
/*
* Then the GPIO chip
*/
ret = sh_pfc_register_gpiochip(pfc);
if (unlikely(ret != 0)) {
/*
* If the GPIO chip fails to come up we still leave the
* PFC state as it is, given that there are already
* extant users of it that have succeeded by this point.
*/
dev_notice(pfc->dev, "failed to init GPIO chip, ignoring...\n");
}
#endif
platform_set_drvdata(pdev, pfc);
dev_info(pfc->dev, "%s support registered\n", info->name);
return 0;
}
开发者ID:mauelsha,项目名称:linux,代码行数:73,代码来源:core.c
示例8: tegra_camera_probe
static int tegra_camera_probe(struct platform_device *pdev)
{
int err;
struct tegra_camera_dev *dev;
dev_info(&pdev->dev, "%s\n", __func__);
dev = devm_kzalloc(&pdev->dev, sizeof(struct tegra_camera_dev),
GFP_KERNEL);
if (!dev) {
err = -ENOMEM;
dev_err(&pdev->dev, "%s: unable to allocate memory\n",
__func__);
goto alloc_err;
}
#if defined(CONFIG_ARCH_ACER_T20)
t20_dev = dev;
#elif defined(CONFIG_ARCH_ACER_T30)
t30_dev = dev;
#endif
mutex_init(&dev->tegra_camera_lock);
/* Powergate VE when boot */
mutex_lock(&dev->tegra_camera_lock);
dev->power_refcnt = 0;
#ifndef CONFIG_ARCH_TEGRA_2x_SOC
err = tegra_powergate_partition(TEGRA_POWERGATE_VENC);
if (err)
dev_err(&pdev->dev, "%s: powergate failed.\n", __func__);
#endif
mutex_unlock(&dev->tegra_camera_lock);
dev->dev = &pdev->dev;
/* Get regulator pointer */
#ifdef CONFIG_ARCH_TEGRA_2x_SOC
dev->reg = regulator_get(&pdev->dev, "vcsi");
#else
dev->reg = regulator_get(&pdev->dev, "avdd_dsi_csi");
#endif
if (IS_ERR_OR_NULL(dev->reg)) {
dev_err(&pdev->dev, "%s: couldn't get regulator\n", __func__);
return PTR_ERR(dev->reg);
}
dev->misc_dev.minor = MISC_DYNAMIC_MINOR;
dev->misc_dev.name = TEGRA_CAMERA_NAME;
dev->misc_dev.fops = &tegra_camera_fops;
dev->misc_dev.parent = &pdev->dev;
err = misc_register(&dev->misc_dev);
if (err) {
dev_err(&pdev->dev, "%s: Unable to register misc device!\n",
TEGRA_CAMERA_NAME);
goto misc_register_err;
}
err = tegra_camera_clk_get(pdev, "isp", &dev->isp_clk);
if (err)
goto misc_register_err;
err = tegra_camera_clk_get(pdev, "vi", &dev->vi_clk);
if (err)
goto vi_clk_get_err;
err = tegra_camera_clk_get(pdev, "vi_sensor", &dev->vi_sensor_clk);
if (err)
goto vi_sensor_clk_get_err;
err = tegra_camera_clk_get(pdev, "csus", &dev->csus_clk);
if (err)
goto csus_clk_get_err;
err = tegra_camera_clk_get(pdev, "csi", &dev->csi_clk);
if (err)
goto csi_clk_get_err;
/* dev is set in order to restore in _remove */
platform_set_drvdata(pdev, dev);
return 0;
csi_clk_get_err:
clk_put(dev->csus_clk);
csus_clk_get_err:
clk_put(dev->vi_sensor_clk);
vi_sensor_clk_get_err:
clk_put(dev->vi_clk);
vi_clk_get_err:
clk_put(dev->isp_clk);
misc_register_err:
regulator_put(dev->reg);
alloc_err:
return err;
}
开发者ID:Stepanowegor,项目名称:aosp_jb_a500,代码行数:92,代码来源:tegra_camera.c
示例9: da9052_i2c_read_many
int da9052_i2c_read_many(struct da9052 *da9052,
struct da9052_ssc_msg *sscmsg, int msg_no)
{
struct i2c_msg i2cmsg;
unsigned char data_buf[MAX_READ_WRITE_CNT];
struct da9052_ssc_msg *msg_queue = sscmsg;
int ret = 0;
/* Flag to check if requested registers are contiguous */
unsigned char cont_data = 1;
unsigned char cnt = 0;
/* Check if requested registers are contiguous */
for (cnt = 1; cnt < msg_no; cnt++) {
if ((msg_queue[cnt].addr - msg_queue[cnt-1].addr) != 1) {
/* Difference is not 1, i.e. non-contiguous registers */
cont_data = 0;
break;
}
}
if (cont_data == 0) {
/* Requested registers are non-contiguous */
for (cnt = 0; cnt < msg_no; cnt++) {
ret = da9052->read(da9052, &msg_queue[cnt]);
if (ret != 0) {
dev_info(&da9052->i2c_client->dev,\
"Error in %s", __func__);
return ret;
}
}
return 0;
}
/*
* We want to perform PAGE READ via I2C
* For PAGE READ sequence of I2C transactions is as below
* (slave_addr + reg_addr) + (slave_addr + data_1 + data_2 + ...)
*/
/* Copy address of first register */
data_buf[0] = msg_queue[0].addr;
/* Construct a i2c msg for first transaction of PAGE READ i.e. write */
i2cmsg.addr = da9052->slave_addr ;
i2cmsg.len = 1;
i2cmsg.buf = data_buf;
/*To write the data on I2C set flag to zero */
i2cmsg.flags = 0;
/* Start the i2c transfer by calling host i2c driver function */
ret = i2c_transfer(da9052->adapter, &i2cmsg, 1);
if (ret < 0) {
dev_info(&da9052->i2c_client->dev,\
"1 - i2c_transfer function falied in [%s]!!!\n", __func__);
return ret;
}
/* Now Read the data from da9052 */
/* Construct a i2c msg for second transaction of PAGE READ i.e. read */
i2cmsg.addr = da9052->slave_addr ;
i2cmsg.len = msg_no;
i2cmsg.buf = data_buf;
/*To read the data on I2C set flag to I2C_M_RD */
i2cmsg.flags = I2C_M_RD;
/* Start the i2c transfer by calling host i2c driver function */
ret = i2c_transfer(da9052->adapter,
&i2cmsg, 1);
if (ret < 0) {
dev_info(&da9052->i2c_client->dev,\
"2 - i2c_transfer function falied in [%s]!!!\n", __func__);
return ret;
}
/* Gather READ data */
for (cnt = 0; cnt < msg_no; cnt++)
sscmsg[cnt].data = data_buf[cnt];
return 0;
}
开发者ID:YCsuperlife,项目名称:imx53_kernel,代码行数:82,代码来源:da9052-i2c.c
示例10: da9052_i2c_write_many
int da9052_i2c_write_many(struct da9052 *da9052,
struct da9052_ssc_msg *sscmsg, int msg_no)
{
struct i2c_msg i2cmsg;
unsigned char data_buf[MAX_READ_WRITE_CNT+1];
struct da9052_ssc_msg ctrlb_msg;
struct da9052_ssc_msg *msg_queue = sscmsg;
int ret = 0;
/* Flag to check if requested registers are contiguous */
unsigned char cont_data = 1;
unsigned char cnt = 0;
/* Check if requested registers are contiguous */
for (cnt = 1; cnt < msg_no; cnt++) {
if ((msg_queue[cnt].addr - msg_queue[cnt-1].addr) != 1) {
/* Difference is not 1, i.e. non-contiguous registers */
cont_data = 0;
break;
}
}
if (cont_data == 0) {
/* Requested registers are non-contiguous */
for (cnt = 0; cnt < msg_no; cnt++) {
ret = da9052->write(da9052, &msg_queue[cnt]);
if (ret != 0)
return ret;
}
return 0;
}
/*
* Requested registers are contiguous
* or PAGE WRITE sequence of I2C transactions is as below
* (slave_addr + reg_addr + data_1 + data_2 + ...)
* First read current WRITE MODE via CONTROL_B register of DA9052
*/
ctrlb_msg.addr = DA9052_CONTROLB_REG;
ctrlb_msg.data = 0x0;
ret = da9052->read(da9052, &ctrlb_msg);
if (ret != 0)
return ret;
/* Check if PAGE WRITE mode is set */
if (ctrlb_msg.data & DA9052_CONTROLB_WRITEMODE) {
/* REPEAT WRITE mode is configured */
/* Now set DA9052 into PAGE WRITE mode */
ctrlb_msg.data &= ~DA9052_CONTROLB_WRITEMODE;
ret = da9052->write(da9052, &ctrlb_msg);
if (ret != 0)
return ret;
}
/* Put first register address */
data_buf[0] = msg_queue[0].addr;
for (cnt = 0; cnt < msg_no; cnt++)
data_buf[cnt+1] = msg_queue[cnt].data;
/* Construct a i2c msg for PAGE WRITE */
i2cmsg.addr = da9052->slave_addr ;
/* First register address + all data*/
i2cmsg.len = (msg_no + 1);
i2cmsg.buf = data_buf;
/*To write the data on I2C set flag to zero */
i2cmsg.flags = 0;
/* Start the i2c transfer by calling host i2c driver function */
ret = i2c_transfer(da9052->adapter, &i2cmsg, 1);
if (ret < 0) {
dev_info(&da9052->i2c_client->dev,\
"1 - i2c_transfer function falied in [%s]!!!\n", __func__);
return ret;
}
return 0;
}
开发者ID:YCsuperlife,项目名称:imx53_kernel,代码行数:80,代码来源:da9052-i2c.c
示例11: vnt_run_command
void vnt_run_command(struct work_struct *work)
{
struct vnt_private *priv =
container_of(work, struct vnt_private, run_command_work.work);
if (test_bit(DEVICE_FLAGS_DISCONNECTED, &priv->flags))
return;
if (priv->cmd_running != true)
return;
switch (priv->command_state) {
case WLAN_CMD_INIT_MAC80211_START:
if (priv->mac_hw)
break;
dev_info(&priv->usb->dev, "Starting mac80211\n");
if (vnt_init(priv)) {
/* If fail all ends TODO retry */
dev_err(&priv->usb->dev, "failed to start\n");
ieee80211_free_hw(priv->hw);
return;
}
break;
case WLAN_CMD_TBTT_WAKEUP_START:
vnt_next_tbtt_wakeup(priv);
break;
case WLAN_CMD_BECON_SEND_START:
if (!priv->vif)
break;
vnt_beacon_make(priv, priv->vif);
vnt_mac_reg_bits_on(priv, MAC_REG_TCR, TCR_AUTOBCNTX);
break;
case WLAN_CMD_SETPOWER_START:
vnt_rf_setpower(priv, priv->current_rate,
priv->hw->conf.chandef.chan->hw_value);
break;
case WLAN_CMD_CHANGE_ANTENNA_START:
dev_dbg(&priv->usb->dev, "Change from Antenna%d to",
priv->rx_antenna_sel);
if (priv->rx_antenna_sel == 0) {
priv->rx_antenna_sel = 1;
if (priv->tx_rx_ant_inv == true)
vnt_set_antenna_mode(priv, ANT_RXA);
else
vnt_set_antenna_mode(priv, ANT_RXB);
} else {
priv->rx_antenna_sel = 0;
if (priv->tx_rx_ant_inv == true)
vnt_set_antenna_mode(priv, ANT_RXB);
else
vnt_set_antenna_mode(priv, ANT_RXA);
}
break;
default:
break;
}
vnt_cmd_complete(priv);
}
开发者ID:020gzh,项目名称:linux,代码行数:73,代码来源:wcmd.c
示例12: ld_usb_probe
//.........这里部分代码省略.........
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
if (dev == NULL) {
dev_err(&intf->dev, "Out of memory\n");
goto exit;
}
mutex_init(&dev->mutex);
spin_lock_init(&dev->rbsl);
dev->intf = intf;
init_waitqueue_head(&dev->read_wait);
init_waitqueue_head(&dev->write_wait);
/* workaround for early firmware versions on fast computers */
if ((le16_to_cpu(udev->descriptor.idVendor) == USB_VENDOR_ID_LD) &&
((le16_to_cpu(udev->descriptor.idProduct) == USB_DEVICE_ID_LD_CASSY) ||
(le16_to_cpu(udev->descriptor.idProduct) == USB_DEVICE_ID_LD_COM3LAB)) &&
(le16_to_cpu(udev->descriptor.bcdDevice) <= 0x103)) {
buffer = kmalloc(256, GFP_KERNEL);
if (buffer == NULL) {
dev_err(&intf->dev, "Couldn't allocate string buffer\n");
goto error;
}
/* usb_string makes SETUP+STALL to leave always ControlReadLoop */
usb_string(udev, 255, buffer, 256);
kfree(buffer);
}
iface_desc = intf->cur_altsetting;
/* set up the endpoint information */
for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
endpoint = &iface_desc->endpoint[i].desc;
if (usb_endpoint_is_int_in(endpoint))
dev->interrupt_in_endpoint = endpoint;
if (usb_endpoint_is_int_out(endpoint))
dev->interrupt_out_endpoint = endpoint;
}
if (dev->interrupt_in_endpoint == NULL) {
dev_err(&intf->dev, "Interrupt in endpoint not found\n");
goto error;
}
if (dev->interrupt_out_endpoint == NULL)
dev_warn(&intf->dev, "Interrupt out endpoint not found (using control endpoint instead)\n");
dev->interrupt_in_endpoint_size = usb_endpoint_maxp(dev->interrupt_in_endpoint);
dev->ring_buffer = kmalloc(ring_buffer_size*(sizeof(size_t)+dev->interrupt_in_endpoint_size), GFP_KERNEL);
if (!dev->ring_buffer) {
dev_err(&intf->dev, "Couldn't allocate ring_buffer\n");
goto error;
}
dev->interrupt_in_buffer = kmalloc(dev->interrupt_in_endpoint_size, GFP_KERNEL);
if (!dev->interrupt_in_buffer) {
dev_err(&intf->dev, "Couldn't allocate interrupt_in_buffer\n");
goto error;
}
dev->interrupt_in_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!dev->interrupt_in_urb) {
dev_err(&intf->dev, "Couldn't allocate interrupt_in_urb\n");
goto error;
}
dev->interrupt_out_endpoint_size = dev->interrupt_out_endpoint ? usb_endpoint_maxp(dev->interrupt_out_endpoint) :
udev->descriptor.bMaxPacketSize0;
dev->interrupt_out_buffer = kmalloc(write_buffer_size*dev->interrupt_out_endpoint_size, GFP_KERNEL);
if (!dev->interrupt_out_buffer) {
dev_err(&intf->dev, "Couldn't allocate interrupt_out_buffer\n");
goto error;
}
dev->interrupt_out_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!dev->interrupt_out_urb) {
dev_err(&intf->dev, "Couldn't allocate interrupt_out_urb\n");
goto error;
}
dev->interrupt_in_interval = min_interrupt_in_interval > dev->interrupt_in_endpoint->bInterval ? min_interrupt_in_interval : dev->interrupt_in_endpoint->bInterval;
if (dev->interrupt_out_endpoint)
dev->interrupt_out_interval = min_interrupt_out_interval > dev->interrupt_out_endpoint->bInterval ? min_interrupt_out_interval : dev->interrupt_out_endpoint->bInterval;
/* we can register the device now, as it is ready */
usb_set_intfdata(intf, dev);
retval = usb_register_dev(intf, &ld_usb_class);
if (retval) {
/* something prevented us from registering this driver */
dev_err(&intf->dev, "Not able to get a minor for this device.\n");
usb_set_intfdata(intf, NULL);
goto error;
}
/* let the user know what node this device is now attached to */
dev_info(&intf->dev, "LD USB Device #%d now attached to major %d minor %d\n",
(intf->minor - USB_LD_MINOR_BASE), USB_MAJOR, intf->minor);
exit:
return retval;
error:
ld_usb_delete(dev);
return retval;
}
开发者ID:AeroGirl,项目名称:VAR-SOM-AM33-SDK7-Kernel,代码行数:101,代码来源:ldusb.c
示例13: msm_i2c_recover_bus_busy
static int
msm_i2c_recover_bus_busy(struct msm_i2c_dev *dev)
{
int i;
uint32_t status = readl(dev->base + I2C_STATUS);
int gpio_clk, gpio_dat;
bool gpio_clk_status = false;
if (!(status & (I2C_STATUS_BUS_ACTIVE | I2C_STATUS_WR_BUFFER_FULL)))
return 0;
msm_set_i2c_mux(true, &gpio_clk, &gpio_dat, 0, 0);
if (status & I2C_STATUS_RD_BUFFER_FULL) {
dev_warn(dev->dev, "Read buffer full, status %x, intf %x\n",
status, readl(dev->base + I2C_INTERFACE_SELECT));
writel(I2C_WRITE_DATA_LAST_BYTE, dev->base + I2C_WRITE_DATA);
readl(dev->base + I2C_READ_DATA);
}
else if (status & I2C_STATUS_BUS_MASTER) {
dev_warn(dev->dev, "Still the bus master, status %x, intf %x\n",
status, readl(dev->base + I2C_INTERFACE_SELECT));
writel(I2C_WRITE_DATA_LAST_BYTE | 0xff,
dev->base + I2C_WRITE_DATA);
}
dev_warn(dev->dev, "i2c_scl: %d, i2c_sda: %d\n",
gpio_get_value(gpio_clk), gpio_get_value(gpio_dat));
for (i = 0; i < 9; i++) {
if (gpio_get_value(gpio_dat) && gpio_clk_status)
break;
gpio_direction_output(gpio_clk, 0);
udelay(5);
gpio_direction_output(gpio_dat, 0);
udelay(5);
gpio_direction_input(gpio_clk);
udelay(5);
if (!gpio_get_value(gpio_clk))
usleep_range(20, 30);
if (!gpio_get_value(gpio_clk))
msleep(10);
gpio_clk_status = gpio_get_value(gpio_clk);
gpio_direction_input(gpio_dat);
udelay(5);
}
msm_set_i2c_mux(false, NULL, NULL,
dev->clk_drv_str, dev->dat_drv_str);
udelay(10);
status = readl(dev->base + I2C_STATUS);
if (!(status & I2C_STATUS_BUS_ACTIVE)) {
dev_info(dev->dev, "Bus busy cleared after %d clock cycles, "
"status %x, intf %x\n",
i, status, readl(dev->base + I2C_INTERFACE_SELECT));
return 0;
}
dev_warn(dev->dev, "Bus still busy, status %x, intf %x\n",
status, readl(dev->base + I2C_INTERFACE_SELECT));
if(dev->reset_slave) {
dev_warn(dev->dev, "reset slave\n");
dev->reset_slave();
}
return -EBUSY;
}
开发者ID:vpaull,项目名称:2.6.35-photonic-kernel,代码行数:69,代码来源:i2c-msm.c
示例14: stm_probe
static int stm_probe(struct amba_device *adev, const struct amba_id *id)
{
int ret;
void __iomem *base;
unsigned long *guaranteed;
struct device *dev = &adev->dev;
struct coresight_platform_data *pdata = NULL;
struct stm_drvdata *drvdata;
struct resource *res = &adev->res;
struct resource ch_res;
size_t res_size, bitmap_size;
struct coresight_desc desc = { 0 };
struct device_node *np = adev->dev.of_node;
if (np) {
pdata = of_get_coresight_platform_data(dev, np);
if (IS_ERR(pdata))
return PTR_ERR(pdata);
adev->dev.platform_data = pdata;
}
drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
if (!drvdata)
return -ENOMEM;
drvdata->dev = &adev->dev;
drvdata->atclk = devm_clk_get(&adev->dev, "atclk"); /* optional */
if (!IS_ERR(drvdata->atclk)) {
ret = clk_prepare_enable(drvdata->atclk);
if (ret)
return ret;
}
dev_set_drvdata(dev, drvdata);
base = devm_ioremap_resource(dev, res);
if (IS_ERR(base))
return PTR_ERR(base);
drvdata->base = base;
ret = stm_get_resource_byname(np, "stm-stimulus-base", &ch_res);
if (ret)
return ret;
drvdata->chs.phys = ch_res.start;
base = devm_ioremap_resource(dev, &ch_res);
if (IS_ERR(base))
return PTR_ERR(base);
drvdata->chs.base = base;
drvdata->write_bytes = stm_fundamental_data_size(drvdata);
if (boot_nr_channel) {
drvdata->numsp = boot_nr_channel;
res_size = min((resource_size_t)(boot_nr_channel *
BYTES_PER_CHANNEL), resource_size(res));
} else {
drvdata->numsp = stm_num_stimulus_port(drvdata);
res_size = min((resource_size_t)(drvdata->numsp *
BYTES_PER_CHANNEL), resource_size(res));
}
bitmap_size = BITS_TO_LONGS(drvdata->numsp) * sizeof(long);
guaranteed = devm_kzalloc(dev, bitmap_size, GFP_KERNEL);
if (!guaranteed)
return -ENOMEM;
drvdata->chs.guaranteed = guaranteed;
spin_lock_init(&drvdata->spinlock);
stm_init_default_data(drvdata);
stm_init_generic_data(drvdata);
if (stm_register_device(dev, &drvdata->stm, THIS_MODULE)) {
dev_info(dev,
"stm_register_device failed, probing deferred\n");
return -EPROBE_DEFER;
}
desc.type = CORESIGHT_DEV_TYPE_SOURCE;
desc.subtype.source_subtype = CORESIGHT_DEV_SUBTYPE_SOURCE_SOFTWARE;
desc.ops = &stm_cs_ops;
desc.pdata = pdata;
desc.dev = dev;
desc.groups = coresight_stm_groups;
drvdata->csdev = coresight_register(&desc);
if (IS_ERR(drvdata->csdev)) {
ret = PTR_ERR(drvdata->csdev);
goto stm_unregister;
}
pm_runtime_put(&adev->dev);
dev_info(dev, "%s initialized\n", (char *)id->data);
return 0;
stm_unregister:
stm_unregister_device(&drvdata->stm);
return ret;
}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:98,代码来源:coresight-stm.c
示例15: twl6030_usb_probe
static int twl6030_usb_probe(struct platform_device *pdev)
{
u32 ret;
struct twl6030_usb *twl;
int status, err;
struct device_node *np = pdev->dev.of_node;
struct device *dev = &pdev->dev;
struct twl4030_usb_data *pdata = dev_get_platdata(dev);
twl = devm_kzalloc(dev, sizeof(*twl), GFP_KERNEL);
if (!twl)
return -ENOMEM;
twl->dev = &pdev->dev;
twl->irq1 = platform_get_irq(pdev, 0);
twl->irq2 = platform_get_irq(pdev, 1);
twl->linkstat = MUSB_UNKNOWN;
twl->comparator.set_vbus = twl6030_set_vbus;
twl->comparator.start_srp = twl6030_start_srp;
ret = omap_usb2_set_comparator(&twl->comparator);
if (ret == -ENODEV) {
dev_info(&pdev->dev, "phy not ready, deferring probe");
return -EPROBE_DEFER;
}
if (np) {
twl->regulator = "usb";
} else if (pdata) {
if (pdata->features & TWL6032_SUBCLASS)
twl->regulator = "ldousb";
else
twl->regulator = "vusb";
} else {
dev_err(&pdev->dev, "twl6030 initialized without pdata\n");
return -EINVAL;
}
/* init spinlock for workqueue */
spin_lock_init(&twl->lock);
err = twl6030_usb_ldo_init(twl);
if (err) {
dev_err(&pdev->dev, "ldo init failed\n");
return err;
}
platform_set_drvdata(pdev, twl);
if (device_create_file(&pdev->dev, &dev_attr_vbus))
dev_warn(&pdev->dev, "could not create sysfs file\n");
INIT_WORK(&twl->set_vbus_work, otg_set_vbus_work);
status = request_threaded_irq(twl->irq1, NULL, twl6030_usbotg_irq,
IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING | IRQF_ONESHOT,
"twl6030_usb", twl);
if (status < 0) {
dev_err(&pdev->dev, "can't get IRQ %d, err %d\n",
twl->irq1, status);
device_remove_file(twl->dev, &dev_attr_vbus);
return status;
}
status = request_threaded_irq(twl->irq2, NULL, twl6030_usb_irq,
IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING | IRQF_ONESHOT,
"twl6030_usb", twl);
if (status < 0) {
dev_err(&pdev->dev, "can't get IRQ %d, err %d\n",
twl->irq2, status);
free_irq(twl->irq1, twl);
device_remove_file(twl->dev, &dev_attr_vbus);
return status;
}
twl->asleep = 0;
twl6030_enable_irq(twl);
dev_info(&pdev->dev, "Initialized TWL6030 USB module\n");
return 0;
}
开发者ID:020gzh,项目名称:linux,代码行数:81,代码来源:phy-twl6030-usb.c
示例16: irqc_probe
static int irqc_probe(struct platform_device *pdev)
{
struct irqc_priv *p;
struct resource *io;
struct resource *irq;
struct irq_chip *irq_chip;
const char *name = dev_name(&pdev->dev);
int ret;
int k;
p = kzalloc(sizeof(*p), GFP_KERNEL);
if (!p) {
dev_err(&pdev->dev, "failed to allocate driver data\n");
ret = -ENOMEM;
goto err0;
}
p->pdev = pdev;
platform_set_drvdata(pdev, p);
p->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(p->clk)) {
dev_warn(&pdev->dev, "unable to get clock\n");
p->clk = NULL;
}
pm_runtime_enable(&pdev->dev);
pm_runtime_get_sync(&pdev->dev);
/* get hold of manadatory IOMEM */
io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!io) {
dev_err(&pdev->dev, "not enough IOMEM resources\n");
ret = -EINVAL;
goto err1;
}
/* allow any number of IRQs between 1 and IRQC_IRQ_MAX */
for (k = 0; k < IRQC_IRQ_MAX; k++) {
irq = platform_get_resource(pdev, IORESOURCE_IRQ, k);
if (!irq)
break;
p->irq[k].p = p;
p->irq[k].requested_irq = irq->start;
}
p->number_of_irqs = k;
if (p->number_of_irqs < 1) {
dev_err(&pdev->dev, "not enough IRQ resources\n");
ret = -EINVAL;
goto err1;
}
/* ioremap IOMEM and setup read/write callbacks */
p->iomem = ioremap_nocache(io->start, resource_size(io));
if (!p->iomem) {
dev_err(&pdev->dev, "failed to remap IOMEM\n");
ret = -ENXIO;
goto err2;
}
p->cpu_int_base = p->iomem + IRQC_INT_CPU_BASE(0); /* SYS-SPI */
irq_chip = &p->irq_chip;
irq_chip->name = name;
irq_chip->irq_mask = irqc_irq_disable;
irq_chip->irq_unmask = irqc_irq_enable;
irq_chip->irq_set_type = irqc_irq_set_type;
irq_chip->irq_set_wake = irqc_irq_set_wake;
irq_chip->flags = IRQCHIP_MASK_ON_SUSPEND;
p->irq_domain = irq_domain_add_simple(pdev->dev.of_node,
p->number_of_irqs, 0,
&irqc_irq_domain_ops, p);
if (!p->irq_domain) {
ret = -ENXIO;
dev_err(&pdev->dev, "cannot initialize irq domain\n");
goto err2;
}
/* request interrupts one by one */
for (k = 0; k < p->number_of_irqs; k++) {
if (request_irq(p->irq[k].requested_irq, irqc_irq_handler,
0, name, &p->irq[k])) {
dev_err(&pdev->dev, "failed to request IRQ\n");
ret = -ENOENT;
goto err3;
}
}
dev_info(&pdev->dev, "driving %d irqs\n", p->number_of_irqs);
return 0;
err3:
while (--k >=
|
请发表评论