本文整理汇总了C++中DEVNAME函数的典型用法代码示例。如果您正苦于以下问题:C++ DEVNAME函数的具体用法?C++ DEVNAME怎么用?C++ DEVNAME使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DEVNAME函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: thinkpad_adaptive_change
int
thinkpad_adaptive_change(struct acpithinkpad_softc *sc)
{
struct aml_value arg;
int64_t mode;
if (aml_evalinteger(sc->sc_acpi, sc->sc_devnode, "GTRW",
0, NULL, &mode)) {
printf("%s: couldn't get adaptive keyboard mode\n", DEVNAME(sc));
return (1);
}
bzero(&arg, sizeof(arg));
arg.type = AML_OBJTYPE_INTEGER;
if (mode == THINKPAD_ADAPTIVE_MODE_FUNCTION)
arg.v_integer = THINKPAD_ADAPTIVE_MODE_HOME;
else
arg.v_integer = THINKPAD_ADAPTIVE_MODE_FUNCTION;
if (aml_evalname(sc->sc_acpi, sc->sc_devnode, "STRW",
1, &arg, NULL)) {
printf("%s: couldn't set adaptive keyboard mode\n", DEVNAME(sc));
return (1);
}
return (0);
}
示例2: acpidock_eject
int
acpidock_eject(struct acpidock_softc *sc, struct aml_node *node)
{
struct aml_value cmd;
struct aml_value res;
int rv;
if (node != sc->sc_devnode)
aml_notify(node, 3);
memset(&cmd, 0, sizeof cmd);
cmd.v_integer = 1;
cmd.type = AML_OBJTYPE_INTEGER;
if (aml_evalname(sc->sc_acpi, node, "_EJ0", 1, &cmd,
&res) != 0) {
dnprintf(15, "%s: _EJ0 failed\n", DEVNAME(sc));
rv = 0;
} else {
dnprintf(15, "%s: _EJ0 successful\n", DEVNAME(sc));
rv = 1;
}
aml_freevalue(&res);
return (rv);
}
示例3: acpitz_setcpu
int
acpitz_setcpu(struct acpitz_softc *sc, int trend)
{
struct aml_value res0, *ref;
int x;
if (aml_evalname(sc->sc_acpi, sc->sc_devnode, "_PSL", 0, NULL, &res0)) {
printf("%s: _PSL failed\n", DEVNAME(sc));
goto out;
}
if (res0.type != AML_OBJTYPE_PACKAGE) {
printf("%s: not a package\n", DEVNAME(sc));
goto out;
}
for (x = 0; x < res0.length; x++) {
if (res0.v_package[x]->type != AML_OBJTYPE_OBJREF) {
printf("%s: _PSL[%d] not a object ref\n", DEVNAME(sc), x);
continue;
}
ref = res0.v_package[x]->v_objref.ref;
if (ref->type != AML_OBJTYPE_PROCESSOR)
printf("%s: _PSL[%d] not a CPU\n", DEVNAME(sc), x);
}
out:
aml_freevalue(&res0);
return (0);
}
示例4: cs_pcmcia_enable
static int
cs_pcmcia_enable(struct cs_softc *sc)
{
struct cs_pcmcia_softc *psc = (void *)sc;
struct pcmcia_function *pf = psc->sc_pf;
if (pcmcia_io_map(pf, PCMCIA_WIDTH_AUTO, 0, psc->sc_pcioh.size,
&psc->sc_pcioh, &psc->sc_io_window) != 0) {
printf("%s: can't map i/o space\n", DEVNAME(sc));
goto fail;
}
psc->sc_flags |= CS_PCMCIA_FLAGS_IO_MAPPED;
if (pcmcia_function_enable(pf)) {
printf("%s: can't enable function\n", DEVNAME(sc));
goto fail;
}
sc->sc_ih = pcmcia_intr_establish(pf, IPL_NET, cs_intr, sc);
if (sc->sc_ih == 0) {
printf("%s: can't establish interrupt\n", DEVNAME(sc));
goto fail;
}
return 0;
fail:
return EIO;
}
示例5: armv7_attach
void
armv7_attach(struct device *parent, struct device *self, void *aux)
{
struct armv7_softc *sc = (struct armv7_softc *)self;
struct board_dev *bd;
sc->sc_board_devs = platform_board_devs();
if (hw_prod)
printf(": %s\n", hw_prod);
else
printf(": UNKNOWN BOARD %u\n", board_id);
/* Directly configure on-board devices (dev* in config file). */
for (bd = sc->sc_board_devs; bd->name != NULL; bd++) {
struct armv7_dev *ad = armv7_find_dev(bd->name, bd->unit);
struct armv7_attach_args aa;
if (ad == NULL) {
printf("%s: device %s unit %d not found\n",
DEVNAME(sc), bd->name, bd->unit);
continue;
}
memset(&aa, 0, sizeof(aa));
aa.aa_dev = ad;
aa.aa_iot = &armv7_bs_tag;
aa.aa_dmat = &armv7_bus_dma_tag;
if (config_found_sm(self, &aa, NULL, armv7_submatch) == NULL)
printf("%s: device %s unit %d not configured\n",
DEVNAME(sc), bd->name, bd->unit);
}
}
示例6: emc_attach
void
emc_attach(struct device *parent, struct device *self, void *aux)
{
struct emc_softc *sc = (struct emc_softc *)self;
struct scsi_attach_args *sa = aux;
struct scsi_link *link = sa->sa_sc_link;
int sp;
printf("\n");
/* init link */
link->device_softc = sc;
/* init path */
scsi_xsh_set(&sc->sc_path.p_xsh, link, emc_mpath_start);
sc->sc_path.p_link = link;
/* init status handler */
scsi_xsh_set(&sc->sc_xsh, link, emc_status);
sc->sc_pg = dma_alloc(sizeof(*sc->sc_pg), PR_WAITOK);
/* let's go */
if (emc_sp_info(sc, &sp)) {
printf("%s: unable to get sp info\n", DEVNAME(sc));
return;
}
if (mpath_path_attach(&sc->sc_path, sp, &emc_mpath_ops) != 0)
printf("%s: unable to attach path\n", DEVNAME(sc));
}
示例7: che_read_eeprom
int
che_read_eeprom(struct cheg_softc *sc, struct pci_attach_args *pa,
pcireg_t addr, pcireg_t *dp)
{
pcireg_t rv, base;
int i = 4;
if (!pci_get_capability(pa->pa_pc, pa->pa_tag, CHE_PCI_CAP_ID_VPD,
&base, NULL)) {
printf("%s: VPD EEPROM not found\n",
DEVNAME(sc), addr);
return EIO;
}
addr <<= 16;
pci_conf_write(pa->pa_pc, pa->pa_tag, base, addr);
while(i--) {
delay(10);
rv = pci_conf_read(pa->pa_pc, pa->pa_tag, base);
if (rv & CHE_PCI_F_VPD_ADDR)
break;
}
if (!(rv & CHE_PCI_F_VPD_ADDR)) {
printf("%s: reading EEPROM address 0x%x failed\n",
DEVNAME(sc), addr);
return EIO;
}
*dp = pci_conf_read(pa->pa_pc, pa->pa_tag, base + CHE_PCI_VPD_DATA);
return (0);
}
示例8: com_cardbus_enable
int
com_cardbus_enable(struct com_softc *sc)
{
struct com_cardbus_softc *csc = (struct com_cardbus_softc*)sc;
struct cardbus_softc *psc =
(struct cardbus_softc *)sc->sc_dev.dv_parent;
cardbus_chipset_tag_t cc = psc->sc_cc;
cardbus_function_tag_t cf = psc->sc_cf;
Cardbus_function_enable(csc->cc_ct);
com_cardbus_setup(csc);
/* establish the interrupt. */
csc->cc_ih = cardbus_intr_establish(cc, cf, psc->sc_intrline,
IPL_TTY, comintr, sc, DEVNAME(csc));
if (csc->cc_ih == NULL) {
printf("%s: couldn't establish interrupt\n", DEVNAME(csc));
return (1);
}
printf(": irq %d", psc->sc_intrline);
return (0);
}
示例9: safte_attach
void
safte_attach(struct device *parent, struct device *self, void *aux)
{
struct safte_softc *sc = (struct safte_softc *)self;
struct scsi_attach_args *sa = aux;
int i = 0;
sc->sc_link = sa->sa_sc_link;
sa->sa_sc_link->device_softc = sc;
rw_init(&sc->sc_lock, DEVNAME(sc));
printf("\n");
sc->sc_encbuf = NULL;
sc->sc_nsensors = 0;
#if NBIO > 0
sc->sc_nslots = 0;
#endif
if (safte_read_config(sc) != 0) {
printf("%s: unable to read enclosure configuration\n",
DEVNAME(sc));
return;
}
if (sc->sc_nsensors > 0) {
sc->sc_sensortask = sensor_task_register(sc,
safte_read_encstat, 10);
if (sc->sc_sensortask == NULL) {
printf("%s: unable to register update task\n",
DEVNAME(sc));
sc->sc_nsensors = sc->sc_ntemps = 0;
free(sc->sc_sensors, M_DEVBUF);
} else {
for (i = 0; i < sc->sc_nsensors; i++)
sensor_attach(&sc->sc_sensordev,
&sc->sc_sensors[i].se_sensor);
sensordev_install(&sc->sc_sensordev);
}
}
#if NBIO > 0
if (sc->sc_nslots > 0 &&
bio_register(self, safte_ioctl) != 0) {
printf("%s: unable to register ioctl with bio\n", DEVNAME(sc));
sc->sc_nslots = 0;
} else
i++;
#endif
if (i) /* if we're doing something, then preinit encbuf and sensors */
safte_read_encstat(sc);
else {
free(sc->sc_encbuf, M_DEVBUF);
sc->sc_encbuf = NULL;
}
}
示例10: mfi_pci_attach
void
mfi_pci_attach(struct device *parent, struct device *self, void *aux)
{
struct mfi_softc *sc = (struct mfi_softc *)self;
struct pci_attach_args *pa = aux;
const struct mfi_pci_device *mpd;
pci_intr_handle_t ih;
bus_size_t size;
pcireg_t reg;
int regbar;
mpd = mfi_pci_find_device(pa);
if (mpd == NULL) {
printf(": can't find matching pci device\n");
return;
}
if (mpd->mpd_iop == MFI_IOP_GEN2 || mpd->mpd_iop == MFI_IOP_SKINNY)
regbar = MFI_BAR_GEN2;
else
regbar = MFI_BAR;
reg = pci_mapreg_type(pa->pa_pc, pa->pa_tag, regbar);
if (pci_mapreg_map(pa, regbar, reg, 0,
&sc->sc_iot, &sc->sc_ioh, NULL, &size, MFI_PCI_MEMSIZE)) {
printf(": can't map controller pci space\n");
return;
}
sc->sc_dmat = pa->pa_dmat;
if (pci_intr_map(pa, &ih) != 0) {
printf(": can't map interrupt\n");
goto unmap;
}
printf(": %s\n", pci_intr_string(pa->pa_pc, ih));
sc->sc_ih = pci_intr_establish(pa->pa_pc, ih, IPL_BIO, mfi_intr, sc,
sc->sc_dev.dv_xname);
if (!sc->sc_ih) {
printf("%s: can't establish interrupt\n", DEVNAME(sc));
goto unmap;
}
if (mfi_attach(sc, mpd->mpd_iop)) {
printf("%s: can't attach\n", DEVNAME(sc));
goto unintr;
}
return;
unintr:
pci_intr_disestablish(pa->pa_pc, sc->sc_ih);
sc->sc_ih = NULL;
unmap:
bus_space_unmap(sc->sc_iot, sc->sc_ioh, size);
}
示例11: usbf_create_thread
/*
* Called from the kernel proper when it can create threads.
*/
void
usbf_create_thread(void *arg)
{
struct usbf_softc *sc = arg;
if (kthread_create(usbf_task_thread, sc, &sc->sc_proc, "%s",
DEVNAME(sc)) != 0) {
printf("%s: can't create task thread\n", DEVNAME(sc));
return;
}
config_pending_decr();
}
示例12: usbf_attach
void
usbf_attach(struct device *parent, struct device *self, void *aux)
{
struct usbf_softc *sc = (struct usbf_softc *)self;
int usbrev;
int speed;
usbf_status err;
/* Continue to set up the bus struct. */
sc->sc_bus = aux;
sc->sc_bus->usbfctl = sc;
usbrev = sc->sc_bus->usbrev;
printf(": USB revision %s", usbrev_str[usbrev]);
switch (usbrev) {
case USBREV_2_0:
speed = USB_SPEED_HIGH;
break;
case USBREV_1_1:
case USBREV_1_0:
speed = USB_SPEED_FULL;
break;
default:
printf(", not supported\n");
sc->sc_dying = 1;
return;
}
printf("\n");
/* Initialize the usbf struct. */
TAILQ_INIT(&sc->sc_tskq);
/* Establish the software interrupt. */
if (usbf_softintr_establish(sc->sc_bus)) {
printf("%s: can't establish softintr\n", DEVNAME(sc));
sc->sc_dying = 1;
return;
}
/* Attach the function driver. */
err = usbf_new_device(self, sc->sc_bus, 0, speed, 0, &sc->sc_port);
if (err) {
printf("%s: usbf_new_device failed, %s\n", DEVNAME(sc),
usbf_errstr(err));
sc->sc_dying = 1;
return;
}
/* Create a process context for asynchronous tasks. */
config_pending_incr();
kthread_create_deferred(usbf_create_thread, sc);
}
示例13: acpitz_refresh
void
acpitz_refresh(void *arg)
{
struct acpitz_softc *sc = arg;
int i, trend;
extern int acpi_s5;
dnprintf(30, "%s: %s: refresh\n", DEVNAME(sc),
sc->sc_devnode->parent->name);
if (-1 == (sc->sc_tmp = acpitz_getreading(sc, "_TMP"))) {
dnprintf(30, "%s: %s: failed to read temp!\n", DEVNAME(sc),
sc->sc_devnode->parent->name);
sc->sc_tmp = 0; /* XXX */
}
if (sc->sc_crt != -1 && sc->sc_crt <= sc->sc_tmp) {
/* Do critical shutdown */
printf("%s: Critical temperature, shutting down!\n",
DEVNAME(sc));
acpi_s5 = 1;
psignal(initproc, SIGUSR1);
}
if (sc->sc_hot != -1 && sc->sc_hot <= sc->sc_tmp)
printf("%s: _HOT temperature\n", DEVNAME(sc));
if (sc->sc_lasttmp != -1 && sc->sc_tc1 != -1 && sc->sc_tc2 != -1 &&
sc->sc_psv != -1) {
if (sc->sc_psv <= sc->sc_tmp) {
sc->sc_pse = 1;
trend = sc->sc_tc1 * (sc->sc_tmp - sc->sc_lasttmp) +
sc->sc_tc2 * (sc->sc_tmp - sc->sc_psv);
/* printf("_TZ trend = %d\n", trend); */
} else if (sc->sc_pse)
sc->sc_pse = 0;
}
sc->sc_lasttmp = sc->sc_tmp;
for (i = 0; i < ACPITZ_MAX_AC; i++) {
if (sc->sc_ac[i] != -1 && sc->sc_ac[i] <= sc->sc_tmp) {
/* turn on fan i */
if (sc->sc_ac_stat[i] <= 0)
acpitz_setfan(sc, i, "_ON_");
} else if (sc->sc_ac[i] != -1) {
/* turn off fan i */
if (sc->sc_ac_stat[i] > 0)
acpitz_setfan(sc, i, "_OFF");
}
}
sc->sc_sens.value = sc->sc_tmp * 100000;
}
示例14: ahci_map_intr
int
ahci_map_intr(struct ahci_pci_softc *psc, struct pci_attach_args *pa,
pci_intr_handle_t ih)
{
struct ahci_softc *sc = &psc->psc_ahci;
sc->sc_ih = pci_intr_establish(psc->psc_pc, ih, IPL_BIO,
ahci_intr, sc, DEVNAME(sc));
if (sc->sc_ih == NULL) {
printf("%s: unable to map interrupt\n", DEVNAME(sc));
return (1);
}
return (0);
}
示例15: toshiba_set_video_output
int
toshiba_set_video_output(struct acpitoshiba_softc *sc, u_int32_t *video_output)
{
struct aml_value args[HCI_WORDS];
int i;
bzero(args, sizeof(args));
if ((*video_output < HCI_VIDEO_OUTPUT_CYCLE_MIN) ||
(*video_output > HCI_VIDEO_OUTPUT_CYCLE_MAX))
return (HCI_FAILURE);
*video_output |= HCI_VIDEO_OUTPUT_FLAG;
for (i = 0; i < HCI_WORDS; ++i)
args[i].type = AML_OBJTYPE_INTEGER;
args[HCI_REG_AX].v_integer = HCI_SET;
args[HCI_REG_BX].v_integer = HCI_REG_VIDEO_OUTPUT;
args[HCI_REG_CX].v_integer = *video_output;
if (aml_evalname(sc->sc_acpi, sc->sc_devnode, METHOD_HCI,
i, args, NULL)) {
printf("%s: set video output failed\n", DEVNAME(sc));
return (HCI_FAILURE);
}
return (HCI_SUCCESS);
}