docstring
stringlengths
22
576
signature
stringlengths
9
317
prompt
stringlengths
57
886
code
stringlengths
20
1.36k
repository
stringclasses
49 values
language
stringclasses
2 values
license
stringclasses
9 values
stars
int64
15
21.3k
/* param base LPSPI peripheral base address. param handle pointer to lpspi_slave_edma_handle_t structure which stores the transfer state. param count Number of bytes transferred so far by the eDMA transaction. return status of status_t. */
status_t LPSPI_SlaveTransferGetCountEDMA(LPSPI_Type *base, lpspi_slave_edma_handle_t *handle, size_t *count)
/* param base LPSPI peripheral base address. param handle pointer to lpspi_slave_edma_handle_t structure which stores the transfer state. param count Number of bytes transferred so far by the eDMA transaction. return status of status_t. */ status_t LPSPI_SlaveTransferGetCountEDMA(LPSPI_Type *base, lpspi_slave_edma_handle_t *handle, size_t *count)
{ assert(handle); if (NULL == count) { return kStatus_InvalidArgument; } if (handle->state != (uint8_t)kLPSPI_Busy) { *count = 0; return kStatus_NoTransferInProgress; } size_t remainingByte; remainingByte = (uint32_t)handle->nbytes * EDMA_GetRemainingMajorLoopCount(handle->edmaRxRegToRxDataHandle->base, handle->edmaRxRegToRxDataHandle->channel); *count = handle->totalByteCount - remainingByte; return kStatus_Success; }
eclipse-threadx/getting-started
C++
Other
310
/* This function determines the size of the flash on the device. */
uint32_t SysCtlFlashSizeGet(void)
/* This function determines the size of the flash on the device. */ uint32_t SysCtlFlashSizeGet(void)
{ return (2048 * ((HWREG(FLASH_PP) & FLASH_PP_SIZE_M) + 1)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Initialize new opaque EC Point object. This object represents an EC point within the given EC group (curve). */
VOID* EFIAPI EcPointInit(IN CONST VOID *EcGroup)
/* Initialize new opaque EC Point object. This object represents an EC point within the given EC group (curve). */ VOID* EFIAPI EcPointInit(IN CONST VOID *EcGroup)
{ CALL_CRYPTO_SERVICE (EcPointInit, (EcGroup), NULL); }
tianocore/edk2
C++
Other
4,240
/* Write an byte to SPI Bus then read back an byte. */
uint8_t SpiDrv_Transfer(uint8_t ucData)
/* Write an byte to SPI Bus then read back an byte. */ uint8_t SpiDrv_Transfer(uint8_t ucData)
{ unsigned long ucRecv = 0; while(xSPIIsTxEmpty(xSPI1_BASE) == xfalse); SPIDataPut(xSPI1_BASE, ucData); while(SPIIsRxNotEmpty(xSPI1_BASE) == xfalse); xSPIDataGet(xSPI1_BASE, &ucRecv); delay(0x5F); return (ucRecv); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Kick the writeback threads then try to free up some ZONE_NORMAL memory. */
static void free_more_memory(void)
/* Kick the writeback threads then try to free up some ZONE_NORMAL memory. */ static void free_more_memory(void)
{ struct zone *zone; int nid; wakeup_flusher_threads(1024); yield(); for_each_online_node(nid) { (void)first_zones_zonelist(node_zonelist(nid, GFP_NOFS), gfp_zone(GFP_NOFS), NULL, &zone); if (zone) try_to_free_pages(node_zonelist(nid, GFP_NOFS), 0, GFP_NOFS, NULL); } }
robutest/uclinux
C++
GPL-2.0
60
/* param base SAI base pointer. param handle SAI eDMA handle pointer. param base SAI peripheral base address. param callback Pointer to user callback function. param userData User parameter passed to the callback function. param dmaHandle eDMA handle pointer, this handle shall be static allocated by users. */
void SAI_TransferTxCreateHandleEDMA(I2S_Type *base, sai_edma_handle_t *handle, sai_edma_callback_t callback, void *userData, edma_handle_t *dmaHandle)
/* param base SAI base pointer. param handle SAI eDMA handle pointer. param base SAI peripheral base address. param callback Pointer to user callback function. param userData User parameter passed to the callback function. param dmaHandle eDMA handle pointer, this handle shall be static allocated by users. */ void SAI_TransferTxCreateHandleEDMA(I2S_Type *base, sai_edma_handle_t *handle, sai_edma_callback_t callback, void *userData, edma_handle_t *dmaHandle)
{ assert(handle && dmaHandle); uint32_t instance = SAI_GetInstance(base); memset(handle, 0, sizeof(*handle)); handle->dmaHandle = dmaHandle; handle->callback = callback; handle->userData = userData; handle->state = kSAI_Idle; s_edmaPrivateHandle[instance][0].base = base; s_edmaPrivateHandle[instance][0].handle = handle; EDMA_InstallTCDMemory(dmaHandle, (edma_tcd_t *)(STCD_ADDR(handle->tcd)), SAI_XFER_QUEUE_SIZE); EDMA_SetCallback(dmaHandle, SAI_TxEDMACallback, &s_edmaPrivateHandle[instance][0]); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Calculates the largest ACL payload that the controller can accept. */
static uint16_t ble_hs_hci_max_acl_payload_sz(void)
/* Calculates the largest ACL payload that the controller can accept. */ static uint16_t ble_hs_hci_max_acl_payload_sz(void)
{ return ble_hs_hci_buf_sz; }
arendst/Tasmota
C++
GNU General Public License v3.0
21,318
/* Returns: (transfer none): the #GFlagsValue with nickname @nick, or NULL if there is no flag with that nickname */
GFlagsValue* g_flags_get_value_by_nick(GFlagsClass *flags_class, const gchar *nick)
/* Returns: (transfer none): the #GFlagsValue with nickname @nick, or NULL if there is no flag with that nickname */ GFlagsValue* g_flags_get_value_by_nick(GFlagsClass *flags_class, const gchar *nick)
{ g_return_val_if_fail (G_IS_FLAGS_CLASS (flags_class), NULL); g_return_val_if_fail (nick != NULL, NULL); if (flags_class->n_values) { GFlagsValue *flags_value; for (flags_value = flags_class->values; flags_value->value_nick; flags_value++) if (flags_value->value_nick && strcmp (nick, flags_value->value_nick) == 0) return flags_value; } return NULL; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Enable MAC address for PTP frame filtering. When enabled, uses MAC address (apart from MAC address 0) to filter the PTP frames when PTP is sent directly over Ethernet. */
void synopGMAC_TS_mac_addr_filt_enable(synopGMACdevice *gmacdev)
/* Enable MAC address for PTP frame filtering. When enabled, uses MAC address (apart from MAC address 0) to filter the PTP frames when PTP is sent directly over Ethernet. */ void synopGMAC_TS_mac_addr_filt_enable(synopGMACdevice *gmacdev)
{ synopGMACSetBits(gmacdev->MacBase, GmacTSControl, GmacTSENMACADDR); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* spider_net_init_card initializes the card so that other registers can be used */
static void spider_net_init_card(struct spider_net_card *card)
/* spider_net_init_card initializes the card so that other registers can be used */ static void spider_net_init_card(struct spider_net_card *card)
{ spider_net_write_reg(card, SPIDER_NET_CKRCTRL, SPIDER_NET_CKRCTRL_STOP_VALUE); spider_net_write_reg(card, SPIDER_NET_CKRCTRL, SPIDER_NET_CKRCTRL_RUN_VALUE); spider_net_write_reg(card, SPIDER_NET_GMACOPEMD, spider_net_read_reg(card, SPIDER_NET_GMACOPEMD) | 0x4); spider_net_disable_interrupts(card); }
robutest/uclinux
C++
GPL-2.0
60
/* Description: Process a user generated LISTALL message and respond accordingly. Returns zero on success and negative values on error. */
static int netlbl_cipsov4_listall(struct sk_buff *skb, struct netlink_callback *cb)
/* Description: Process a user generated LISTALL message and respond accordingly. Returns zero on success and negative values on error. */ static int netlbl_cipsov4_listall(struct sk_buff *skb, struct netlink_callback *cb)
{ struct netlbl_cipsov4_doiwalk_arg cb_arg; u32 doi_skip = cb->args[0]; cb_arg.nl_cb = cb; cb_arg.skb = skb; cb_arg.seq = cb->nlh->nlmsg_seq; cipso_v4_doi_walk(&doi_skip, netlbl_cipsov4_listall_cb, &cb_arg); cb->args[0] = doi_skip; return skb->len; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Updates the probe callback corresponding to a range of tracepoints. */
void tracepoint_update_probe_range(struct tracepoint *begin, struct tracepoint *end)
/* Updates the probe callback corresponding to a range of tracepoints. */ void tracepoint_update_probe_range(struct tracepoint *begin, struct tracepoint *end)
{ struct tracepoint *iter; struct tracepoint_entry *mark_entry; if (!begin) return; mutex_lock(&tracepoints_mutex); for (iter = begin; iter < end; iter++) { mark_entry = get_tracepoint(iter->name); if (mark_entry) { set_tracepoint(&mark_entry, iter, !!mark_entry->refcount); } else { disable_tracepoint(iter); } } mutex_unlock(&tracepoints_mutex); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Disable the PWM interrupt of the PWM module. //! The */
void PWMIntDisable(unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntType)
/* Disable the PWM interrupt of the PWM module. //! The */ void PWMIntDisable(unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntType)
{ unsigned long ulChannelTemp; ulChannelTemp = (ulBase == PWMA_BASE) ? ulChannel : (ulChannel - 4); xASSERT((ulBase == PWMA_BASE) || (ulBase == PWMB_BASE)); xASSERT(((ulChannelTemp >= 0) || (ulChannelTemp <= 3))); xASSERT((ulIntType == PWM_INT_CHXCC) || (ulIntType == PWM_INT_UEV1)); if (ulIntType == PWM_INT_UEV1) { xHWREG(ulBase + TIMER_ICTR) &= ~PWM_INT_UEV1; } else { xHWREG(ulBase + TIMER_ICTR) &= ~(PWM_INT_CHXCC << ulChannelTemp); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* fb_videomode_to_modelist: convert mode array to mode list @modedb: array of struct fb_videomode @num: number of entries in array @head: struct list_head of modelist */
void fb_videomode_to_modelist(const struct fb_videomode *modedb, int num, struct list_head *head)
/* fb_videomode_to_modelist: convert mode array to mode list @modedb: array of struct fb_videomode @num: number of entries in array @head: struct list_head of modelist */ void fb_videomode_to_modelist(const struct fb_videomode *modedb, int num, struct list_head *head)
{ int i; INIT_LIST_HEAD(head); for (i = 0; i < num; i++) { if (fb_add_videomode(&modedb[i], head)) return; } }
robutest/uclinux
C++
GPL-2.0
60
/* When the host requests a descriptor this function is called to determine which descriptor is being requested and start its transmission. */
static void prvGetStandardInterfaceDescriptor(xUSB_REQUEST *pxRequest)
/* When the host requests a descriptor this function is called to determine which descriptor is being requested and start its transmission. */ static void prvGetStandardInterfaceDescriptor(xUSB_REQUEST *pxRequest)
{ switch( ( pxRequest->usValue & ( unsigned short ) 0xff00 ) >> 8 ) { case usbHID_REPORT_DESCRIPTOR: prvSendControlData( ( unsigned char * ) pxReportDescriptor, pxRequest->usLength, sizeof( pxReportDescriptor ), pdTRUE ); break; default: prvSendStall(); break; } }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Acknowledge an expanded io pin's interrupt by clearing the bit in the isr. */
static void expio_ack_irq(uint32_t irq)
/* Acknowledge an expanded io pin's interrupt by clearing the bit in the isr. */ static void expio_ack_irq(uint32_t irq)
{ uint32_t expio = MXC_IRQ_TO_EXPIO(irq); __raw_writew(1 << expio, CPLD_INT_RESET_REG); __raw_writew(0, CPLD_INT_RESET_REG); expio_mask_irq(irq); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Update a record with the data of the Request */
static void update_camelsrt_call(struct camelsrt_call_t *p_camelsrt_call, packet_info *pinfo, guint msg_category)
/* Update a record with the data of the Request */ static void update_camelsrt_call(struct camelsrt_call_t *p_camelsrt_call, packet_info *pinfo, guint msg_category)
{ p_camelsrt_call->category[msg_category].req_num = pinfo->num; p_camelsrt_call->category[msg_category].rsp_num = 0; p_camelsrt_call->category[msg_category].responded = FALSE; p_camelsrt_call->category[msg_category].req_time = pinfo->abs_ts; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Check whether the value of a TPM chip register satisfies the input BIT setting. */
EFI_STATUS PtpCrbWaitRegisterBits(IN UINT32 *Register, IN UINT32 BitSet, IN UINT32 BitClear, IN UINT32 TimeOut)
/* Check whether the value of a TPM chip register satisfies the input BIT setting. */ EFI_STATUS PtpCrbWaitRegisterBits(IN UINT32 *Register, IN UINT32 BitSet, IN UINT32 BitClear, IN UINT32 TimeOut)
{ UINT32 RegRead; UINT32 WaitTime; for (WaitTime = 0; WaitTime < TimeOut; WaitTime += 30) { RegRead = MmioRead32 ((UINTN)Register); if (((RegRead & BitSet) == BitSet) && ((RegRead & BitClear) == 0)) { return EFI_SUCCESS; } MicroSecondDelay (30); } return EFI_TIMEOUT; }
tianocore/edk2
C++
Other
4,240
/* Shift a (signed) quad value left (arithmetic shift left). This is the same as logical shift left! */
quad_t __ashldi3(quad_t a, qshift_t shift)
/* Shift a (signed) quad value left (arithmetic shift left). This is the same as logical shift left! */ quad_t __ashldi3(quad_t a, qshift_t shift)
{ union uu aa; if (shift == 0) { return a; } aa.q = a; if (shift >= INT_BITS) { aa.ul[H] = aa.ul[L] << (shift - INT_BITS); aa.ul[L] = 0; } else { aa.ul[H] = (aa.ul[H] << shift) | (aa.ul[L] >> (INT_BITS - shift)); aa.ul[L] <<= shift; } return aa.q; }
labapart/polymcu
C++
null
201
/* Remove this directory entry node from the list of directory entries and hash table. */
EFI_STATUS FatRemoveDirEnt(IN FAT_OFILE *OFile, IN FAT_DIRENT *DirEnt)
/* Remove this directory entry node from the list of directory entries and hash table. */ EFI_STATUS FatRemoveDirEnt(IN FAT_OFILE *OFile, IN FAT_DIRENT *DirEnt)
{ FAT_ODIR *ODir; ODir = OFile->ODir; if (ODir->CurrentCursor == &DirEnt->Link) { ODir->CurrentCursor = ODir->CurrentCursor->BackLink; } RemoveEntryList (&DirEnt->Link); FatDeleteFromHashTable (ODir, DirEnt); DirEnt->Entry.FileName[0] = DELETE_ENTRY_MARK; DirEnt->Invalid = TRUE; return FatStoreDirEnt (OFile, DirEnt); }
tianocore/edk2
C++
Other
4,240
/* fi An instance of an interface statemachine. event The event, just happened. arg Generic pointer, casted from struct net_device * upon call. */
static void dev_action_start(fsm_instance *fi, int event, void *arg)
/* fi An instance of an interface statemachine. event The event, just happened. arg Generic pointer, casted from struct net_device * upon call. */ static void dev_action_start(fsm_instance *fi, int event, void *arg)
{ struct net_device *dev = arg; struct ctcm_priv *priv = dev->ml_priv; int direction; CTCMY_DBF_DEV_NAME(SETUP, dev, ""); fsm_deltimer(&priv->restart_timer); fsm_newstate(fi, DEV_STATE_STARTWAIT_RXTX); if (IS_MPC(priv)) priv->mpcg->channels_terminating = 0; for (direction = READ; direction <= WRITE; direction++) { struct channel *ch = priv->channel[direction]; fsm_event(ch->fsm, CTC_EVENT_START, ch); } }
robutest/uclinux
C++
GPL-2.0
60
/* Set the GPIO bit data(status) for bit. @method GPIO_SetBit */
void GPIO_SetBit(GPIO_TypeDef GPIOx, GPIO_Pin_TypeDef GPIO_Pin)
/* Set the GPIO bit data(status) for bit. @method GPIO_SetBit */ void GPIO_SetBit(GPIO_TypeDef GPIOx, GPIO_Pin_TypeDef GPIO_Pin)
{ _ASSERT(IS_GPIO_PORT(GPIOx)); _ASSERT(IS_GPIO_PIN_SINGLE(GPIO_Pin)); MGPIO->CTRL.reg[GPIO_GetNum(GPIOx, GPIO_Pin)] = OUTPUT_HIGH; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Extract information we might need from acks to commands and act on it. This is akin to i2400m_report_hook(). Note most of this processing should be done in the function that calls the command. This is here for some cases where it can't happen... */
void i2400m_msg_ack_hook(struct i2400m *i2400m, const struct i2400m_l3l4_hdr *l3l4_hdr, size_t size)
/* Extract information we might need from acks to commands and act on it. This is akin to i2400m_report_hook(). Note most of this processing should be done in the function that calls the command. This is here for some cases where it can't happen... */ void i2400m_msg_ack_hook(struct i2400m *i2400m, const struct i2400m_l3l4_hdr *l3l4_hdr, size_t size)
{ int result; struct device *dev = i2400m_dev(i2400m); unsigned ack_type, ack_status; char strerr[32]; ack_type = le16_to_cpu(l3l4_hdr->type); ack_status = le16_to_cpu(l3l4_hdr->status); switch (ack_type) { case I2400M_MT_CMD_ENTER_POWERSAVE: if (0) { result = i2400m_msg_check_status( l3l4_hdr, strerr, sizeof(strerr)); if (result >= 0) d_printf(1, dev, "ready for power save: %zd\n", size); } break; }; return; }
robutest/uclinux
C++
GPL-2.0
60
/* Write a block of words to eeprom. Writes a block of words to EEPROM at the requested address, erasing if necessary, and locking afterwards. Only wordwise writing is safe for writing any value */
void eeprom_program_words(uint32_t address, uint32_t *data, int length_in_words)
/* Write a block of words to eeprom. Writes a block of words to EEPROM at the requested address, erasing if necessary, and locking afterwards. Only wordwise writing is safe for writing any value */ void eeprom_program_words(uint32_t address, uint32_t *data, int length_in_words)
{ int i; flash_unlock_pecr(); while (FLASH_SR & FLASH_SR_BSY); FLASH_PECR &= ~FLASH_PECR_FTDW; for (i = 0; i < length_in_words; i++) { MMIO32(address + (i * sizeof(uint32_t))) = *(data+i); while (FLASH_SR & FLASH_SR_BSY); } flash_lock_pecr(); }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* If String has only pad spaces, then 0 is returned. If String has no pad spaces or valid decimal digits, then 0 is returned. If the number represented by String overflows according to the range defined by UINTN, then MAX_UINTN is returned. If String is NULL, then ASSERT(). If PcdMaximumAsciiStringLength is not zero, and String contains more than PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then ASSERT(). */
UINTN EFIAPI AsciiStrDecimalToUintn(IN CONST CHAR8 *String)
/* If String has only pad spaces, then 0 is returned. If String has no pad spaces or valid decimal digits, then 0 is returned. If the number represented by String overflows according to the range defined by UINTN, then MAX_UINTN is returned. If String is NULL, then ASSERT(). If PcdMaximumAsciiStringLength is not zero, and String contains more than PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then ASSERT(). */ UINTN EFIAPI AsciiStrDecimalToUintn(IN CONST CHAR8 *String)
{ UINTN Result; if (RETURN_ERROR (AsciiStrDecimalToUintnS (String, (CHAR8 **)NULL, &Result))) { return MAX_UINTN; } return Result; }
tianocore/edk2
C++
Other
4,240
/* The function is invoked after SMBASE relocation in S3 path. It restores configuration according to data saved by normal boot path for both BSP and APs. */
VOID InitializeCpuAfterRebase(IN BOOLEAN IsBsp)
/* The function is invoked after SMBASE relocation in S3 path. It restores configuration according to data saved by normal boot path for both BSP and APs. */ VOID InitializeCpuAfterRebase(IN BOOLEAN IsBsp)
{ UINTN TopOfStack; UINT8 Stack[128]; SetRegister (FALSE); if (mSmmS3ResumeState->MpService2Ppi == 0) { if (IsBsp) { while (mNumberToFinish > 0) { CpuPause (); } } else { TopOfStack = (UINTN)Stack + sizeof (Stack); TopOfStack &= ~(UINTN)(CPU_STACK_ALIGNMENT - 1); CopyMem ((VOID *)(UINTN)mApHltLoopCode, mApHltLoopCodeTemplate, sizeof (mApHltLoopCodeTemplate)); TransferApToSafeState ((UINTN)mApHltLoopCode, TopOfStack, (UINTN)&mNumberToFinish); } } }
tianocore/edk2
C++
Other
4,240
/* param base Pointer to FLEXIO_I2C_Type structure. param rxBuff The buffer to store the received bytes. param rxSize The number of data bytes to be received. */
void FLEXIO_I2C_MasterReadBlocking(FLEXIO_I2C_Type *base, uint8_t *rxBuff, uint8_t rxSize)
/* param base Pointer to FLEXIO_I2C_Type structure. param rxBuff The buffer to store the received bytes. param rxSize The number of data bytes to be received. */ void FLEXIO_I2C_MasterReadBlocking(FLEXIO_I2C_Type *base, uint8_t *rxBuff, uint8_t rxSize)
{ assert(rxBuff); assert(rxSize); while (rxSize--) { while (!(FLEXIO_I2C_MasterGetStatusFlags(base) & kFLEXIO_I2C_RxFullFlag)) { } *rxBuff++ = FLEXIO_I2C_MasterReadByte(base); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* $24 is the control register of Loongson perf counter */
static void stop_perf_counters(void)
/* $24 is the control register of Loongson perf counter */ static void stop_perf_counters(void)
{ __write_64bit_c0_register($24, 0, 0); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* EXTI ISR handler. Check EXTI lines in exti_range for pending interrupts */
static void stm32_exti_isr(const void *exti_range)
/* EXTI ISR handler. Check EXTI lines in exti_range for pending interrupts */ static void stm32_exti_isr(const void *exti_range)
{ const struct device *dev = DEVICE_DT_GET(EXTI_NODE); struct stm32_exti_data *data = dev->data; const struct stm32_exti_range *range = exti_range; int line; for (uint8_t i = 0; i <= range->len; i++) { line = range->start + i; if (stm32_exti_is_pending(line) != 0) { stm32_exti_clear_pending(line); if (!data->cb[line].cb) { continue; } data->cb[line].cb(line, data->cb[line].data); } } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Traverse all shares for a given file, and delete those owned by the given (type of) host */
void nlmsvc_traverse_shares(struct nlm_host *host, struct nlm_file *file, nlm_host_match_fn_t match)
/* Traverse all shares for a given file, and delete those owned by the given (type of) host */ void nlmsvc_traverse_shares(struct nlm_host *host, struct nlm_file *file, nlm_host_match_fn_t match)
{ struct nlm_share *share, **shpp; shpp = &file->f_shares; while ((share = *shpp) != NULL) { if (match(share->s_host, host)) { *shpp = share->s_next; kfree(share); continue; } shpp = &share->s_next; } }
robutest/uclinux
C++
GPL-2.0
60
/* We share a lock (that we have) with device_del(), so we need to defer its call. */
int usb_deauthorize_device(struct usb_device *usb_dev)
/* We share a lock (that we have) with device_del(), so we need to defer its call. */ int usb_deauthorize_device(struct usb_device *usb_dev)
{ usb_lock_device(usb_dev); if (usb_dev->authorized == 0) goto out_unauthorized; usb_dev->authorized = 0; usb_set_configuration(usb_dev, -1); kfree(usb_dev->product); usb_dev->product = kstrdup("n/a (unauthorized)", GFP_KERNEL); kfree(usb_dev->manufacturer); usb_dev->manufacturer = kstrdup("n/a (unauthorized)", GFP_KERNEL); kfree(usb_dev->serial); usb_dev->serial = kstrdup("n/a (unauthorized)", GFP_KERNEL); usb_destroy_configuration(usb_dev); usb_dev->descriptor.bNumConfigurations = 0; out_unauthorized: usb_unlock_device(usb_dev); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Writes low level to the specified GPIO pins. */
void GPIO_ResetBits(GPIO_TypeDef *GPIOx, uint8_t GPIO_Pin)
/* Writes low level to the specified GPIO pins. */ void GPIO_ResetBits(GPIO_TypeDef *GPIOx, uint8_t GPIO_Pin)
{ GPIOx->ODR &= (uint8_t)(~GPIO_Pin); }
remotemcu/remcu-chip-sdks
C++
null
436
/* The next two copy via MMIO data to/from the device. memcpy_{to|from}io() doesn't quite work because some people have to enforce 32-bit access */
static void priv_read_copy(struct isp1760_hcd *priv, u32 *src, __u32 __iomem *dst, u32 len)
/* The next two copy via MMIO data to/from the device. memcpy_{to|from}io() doesn't quite work because some people have to enforce 32-bit access */ static void priv_read_copy(struct isp1760_hcd *priv, u32 *src, __u32 __iomem *dst, u32 len)
{ u32 val; u8 *buff8; if (!src) { printk(KERN_ERR "ERROR: buffer: %p len: %d\n", src, len); return; } while (len >= 4) { *src = __raw_readl(dst); len -= 4; src++; dst++; } if (!len) return; val = isp1760_readl(dst); buff8 = (u8 *)src; while (len) { *buff8 = val; val >>= 8; len--; buff8++; } }
robutest/uclinux
C++
GPL-2.0
60
/* Deinitializes the FSMC PCCARD Bank registers to their default reset values. */
void FSMC_PCCARDDeInit(void)
/* Deinitializes the FSMC PCCARD Bank registers to their default reset values. */ void FSMC_PCCARDDeInit(void)
{ FSMC_Bank4->PCR4 = 0x00000018; FSMC_Bank4->SR4 = 0x00000000; FSMC_Bank4->PMEM4 = 0xFCFCFCFC; FSMC_Bank4->PATT4 = 0xFCFCFCFC; FSMC_Bank4->PIO4 = 0xFCFCFCFC; }
gcallipo/RadioDSP-Stm32f103
C++
Common Creative - Attribution 3.0
51
/* Returns the CR_OK if the selection ran correctly, an error code otherwise. */
enum CRStatus cr_sel_eng_matches_node(CRSelEng *a_this, CRSimpleSel *a_sel, xmlNode *a_node, gboolean *a_result)
/* Returns the CR_OK if the selection ran correctly, an error code otherwise. */ enum CRStatus cr_sel_eng_matches_node(CRSelEng *a_this, CRSimpleSel *a_sel, xmlNode *a_node, gboolean *a_result)
{ g_return_val_if_fail (a_this && PRIVATE (a_this) && a_this && a_node && a_result, CR_BAD_PARAM_ERROR); if (a_node->type != XML_ELEMENT_NODE) { *a_result = FALSE; return CR_OK; } return sel_matches_node_real (a_this, a_sel, a_node, a_result, TRUE, TRUE); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* 3.f Cell Identifier List Segment for not established cells - no establishment possible */
static guint16 be_cell_id_lst_seg_f_not_est_cell(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
/* 3.f Cell Identifier List Segment for not established cells - no establishment possible */ static guint16 be_cell_id_lst_seg_f_not_est_cell(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
{ guint32 curr_offset; curr_offset = offset; proto_tree_add_bits_item(tree, hf_gsm_a_bssmap_spare_bits, tvb, curr_offset<<3, 4, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_gsm_a_bssap_cell_id_list_seg_cell_id_disc, tvb, curr_offset, 1, ENC_BIG_ENDIAN); curr_offset++; proto_tree_add_expert(tree, pinfo, &ei_gsm_a_bssmap_not_decoded_yet, tvb, curr_offset, len-1); return(len); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* waits until all work is done on unit and removes it then from the unit->list of the associated port. */
static void zfcp_unit_release(struct device *dev)
/* waits until all work is done on unit and removes it then from the unit->list of the associated port. */ static void zfcp_unit_release(struct device *dev)
{ struct zfcp_unit *unit = container_of(dev, struct zfcp_unit, sysfs_device); put_device(&unit->port->sysfs_device); kfree(unit); }
robutest/uclinux
C++
GPL-2.0
60
/* Clear the status of the specified analog watchdog flag. */
void ADC_AWD_ClearStatus(CM_ADC_TypeDef *ADCx, uint32_t u32Flag)
/* Clear the status of the specified analog watchdog flag. */ void ADC_AWD_ClearStatus(CM_ADC_TypeDef *ADCx, uint32_t u32Flag)
{ DDL_ASSERT(IS_ADC_UNIT(ADCx)); DDL_ASSERT(IS_ADC_AWD_FLAG(u32Flag)); WRITE_REG8(ADCx->AWDSCLRR, u32Flag); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Set the Access and/or Default ACL of a file. */
static __be32 nfsacld_proc_setacl(struct svc_rqst *rqstp, struct nfsd3_setaclargs *argp, struct nfsd_attrstat *resp)
/* Set the Access and/or Default ACL of a file. */ static __be32 nfsacld_proc_setacl(struct svc_rqst *rqstp, struct nfsd3_setaclargs *argp, struct nfsd_attrstat *resp)
{ svc_fh *fh; __be32 nfserr = 0; dprintk("nfsd: SETACL(2acl) %s\n", SVCFH_fmt(&argp->fh)); fh = fh_copy(&resp->fh, &argp->fh); nfserr = fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_SATTR); if (!nfserr) { nfserr = nfserrno( nfsd_set_posix_acl( fh, ACL_TYPE_ACCESS, argp->acl_access) ); } if (!nfserr) { nfserr = nfserrno( nfsd_set_posix_acl( fh, ACL_TYPE_DEFAULT, argp->acl_default) ); } posix_acl_release(argp->acl_access); posix_acl_release(argp->acl_default); return nfserr; }
robutest/uclinux
C++
GPL-2.0
60
/* If we leave drives set for synchronous transfers (especially CDROMs), and reboot to MacOS, it gets confused, poor thing. So, on reboot we reset the SCSI bus. */
static int mesh_shutdown(struct macio_dev *mdev)
/* If we leave drives set for synchronous transfers (especially CDROMs), and reboot to MacOS, it gets confused, poor thing. So, on reboot we reset the SCSI bus. */ static int mesh_shutdown(struct macio_dev *mdev)
{ struct mesh_state *ms = (struct mesh_state *)macio_get_drvdata(mdev); volatile struct mesh_regs __iomem *mr; unsigned long flags; printk(KERN_INFO "resetting MESH scsi bus(es)\n"); spin_lock_irqsave(ms->host->host_lock, flags); mr = ms->mesh; out_8(&mr->intr_mask, 0); out_8(&mr->interrupt, INT_ERROR | INT_EXCEPTION | INT_CMDDONE); out_8(&mr->bus_status1, BS1_RST); mesh_flush_io(mr); udelay(30); out_8(&mr->bus_status1, 0); spin_unlock_irqrestore(ms->host->host_lock, flags); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Read a single byte from the serial port. Returns 1 on success, 0 otherwise. When the function is succesfull, the character read is written into its argument c. */
int serial_tstc(void)
/* Read a single byte from the serial port. Returns 1 on success, 0 otherwise. When the function is succesfull, the character read is written into its argument c. */ int serial_tstc(void)
{ return LSR(CONFIG_SYS_IXP425_CONSOLE) & LSR_DR; }
EmcraftSystems/u-boot
C++
Other
181
/* Disable the 3-wire SPI start interrupt of the specified SPI port. */
void SPI3WireStartIntDisable(unsigned long ulBase)
/* Disable the 3-wire SPI start interrupt of the specified SPI port. */ void SPI3WireStartIntDisable(unsigned long ulBase)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE) ); xHWREG(ulBase + SPI_CNTRL2) &= ~SPI_CNTRL2_SSTA_INTEN; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Progression of requests under I/O to the processing list is prevented by the req->aborted flag being true for these requests. For this reason requests on the io list must be aborted first. */
void fuse_abort_conn(struct fuse_conn *fc)
/* Progression of requests under I/O to the processing list is prevented by the req->aborted flag being true for these requests. For this reason requests on the io list must be aborted first. */ void fuse_abort_conn(struct fuse_conn *fc)
{ spin_lock(&fc->lock); if (fc->connected) { fc->connected = 0; fc->blocked = 0; end_io_requests(fc); end_requests(fc, &fc->pending); end_requests(fc, &fc->processing); wake_up_all(&fc->waitq); wake_up_all(&fc->blocked_waitq); kill_fasync(&fc->fasync, SIGIO, POLL_IN); } spin_unlock(&fc->lock); }
robutest/uclinux
C++
GPL-2.0
60
/* Initialize DMA re-config mode config structure. Fill each pstcDmaRCInit with default value. */
int32_t DMA_ReconfigStructInit(stc_dma_reconfig_init_t *pstcDmaRCInit)
/* Initialize DMA re-config mode config structure. Fill each pstcDmaRCInit with default value. */ int32_t DMA_ReconfigStructInit(stc_dma_reconfig_init_t *pstcDmaRCInit)
{ int32_t i32Ret = LL_OK; if (NULL == pstcDmaRCInit) { i32Ret = LL_ERR_INVD_PARAM; } else { pstcDmaRCInit->u32CountMode = DMA_RC_CNT_KEEP; pstcDmaRCInit->u32DestAddrMode = DMA_RC_DEST_ADDR_KEEP; pstcDmaRCInit->u32SrcAddrMode = DMA_RC_SRC_ADDR_KEEP; } return i32Ret; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Function called on init for each RaspberryPi Pico ADC device. It setups all channels to return constant 0 mV and create acquisition thread. */
static int adc_rpi_init(const struct device *dev)
/* Function called on init for each RaspberryPi Pico ADC device. It setups all channels to return constant 0 mV and create acquisition thread. */ static int adc_rpi_init(const struct device *dev)
{ const struct adc_rpi_config *config = dev->config; struct adc_rpi_data *data = dev->data; int ret; ret = pinctrl_apply_state(config->pcfg, PINCTRL_STATE_DEFAULT); if (ret < 0) { return ret; } ret = clock_control_on(config->clk_dev, config->clk_id); if (ret < 0) { return ret; } ret = reset_line_toggle_dt(&config->reset); if (ret < 0) { return ret; } config->irq_configure(); adc_fifo_setup(true, false, 1, true, true); adc_set_clkdiv(0.f); adc_enable(); adc_irq_set_enabled(true); adc_context_unlock_unconditionally(&data->ctx); return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Starts the TIMER One Pulse signal generation in interrupt mode. */
void ald_timer_one_pulse_start_by_it(ald_timer_handle_t *hperh, ald_timer_op_output_channel_t ch)
/* Starts the TIMER One Pulse signal generation in interrupt mode. */ void ald_timer_one_pulse_start_by_it(ald_timer_handle_t *hperh, ald_timer_op_output_channel_t ch)
{ ald_timer_interrupt_config(hperh, ALD_TIMER_IT_CC1, ENABLE); ald_timer_interrupt_config(hperh, ALD_TIMER_IT_CC2, ENABLE); timer_ccx_channel_cmd(hperh->perh, ALD_TIMER_CHANNEL_1, ENABLE); timer_ccx_channel_cmd(hperh->perh, ALD_TIMER_CHANNEL_2, ENABLE); if (IS_TIMER_BREAK_INSTANCE(hperh->perh) != RESET) ALD_TIMER_MOE_ENABLE(hperh); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Function called from SPI1 IRQ Handler when RXNE flag is set Function is in charge of retrieving received byte from SPI lines. */
void SPI1_Rx_Callback(void)
/* Function called from SPI1 IRQ Handler when RXNE flag is set Function is in charge of retrieving received byte from SPI lines. */ void SPI1_Rx_Callback(void)
{ aRxBuffer[ubReceiveIndex++] = LL_SPI_ReceiveData8(SPI1); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* wake up sync - echo event was catched */
void snd_seq_oss_writeq_wakeup(struct seq_oss_writeq *q, abstime_t time)
/* wake up sync - echo event was catched */ void snd_seq_oss_writeq_wakeup(struct seq_oss_writeq *q, abstime_t time)
{ unsigned long flags; spin_lock_irqsave(&q->sync_lock, flags); q->sync_time = time; q->sync_event_put = 0; if (waitqueue_active(&q->sync_sleep)) { wake_up(&q->sync_sleep); } spin_unlock_irqrestore(&q->sync_lock, flags); }
robutest/uclinux
C++
GPL-2.0
60
/* Disable the automatic slave select function of the specified SPI port. */
void SPIAutoSSDisable(unsigned long ulBase)
/* Disable the automatic slave select function of the specified SPI port. */ void SPIAutoSSDisable(unsigned long ulBase)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE) || (ulBase == SPI3_BASE)); xHWREG(ulBase + SPI_SSR) &= ~SPI_AUTOSS; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Return the LED back to the default configuration. */
static s32 e1000_cleanup_led_ich8lan(struct e1000_hw *hw)
/* Return the LED back to the default configuration. */ static s32 e1000_cleanup_led_ich8lan(struct e1000_hw *hw)
{ if (hw->phy.type == e1000_phy_ife) return e1e_wphy(hw, IFE_PHY_SPECIAL_CONTROL_LED, 0); ew32(LEDCTL, hw->mac.ledctl_default); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* This function validates the System Vector Base in the GICD. */
STATIC VOID EFIAPI ValidateGICDSystemVectorBase(IN UINT8 *Ptr, IN VOID *Context)
/* This function validates the System Vector Base in the GICD. */ STATIC VOID EFIAPI ValidateGICDSystemVectorBase(IN UINT8 *Ptr, IN VOID *Context)
{ if (*(UINT32 *)Ptr != 0) { IncrementErrorCount (); Print ( L"\nERROR: System Vector Base must be zero." ); } }
tianocore/edk2
C++
Other
4,240
/* returns 0, with id set if drive is detected -1, if drive detection failed */
static int pg_probe(struct pg *dev)
/* returns 0, with id set if drive is detected -1, if drive detection failed */ static int pg_probe(struct pg *dev)
{ if (dev->drive == -1) { for (dev->drive = 0; dev->drive <= 1; dev->drive++) if (!pg_reset(dev)) return pg_identify(dev, 1); } else { if (!pg_reset(dev)) return pg_identify(dev, 1); } return -1; }
robutest/uclinux
C++
GPL-2.0
60
/* Returns the size of one sample (in bytes) on the given channel. */
static unsigned char GetSampleSize(unsigned char channel)
/* Returns the size of one sample (in bytes) on the given channel. */ static unsigned char GetSampleSize(unsigned char channel)
{ unsigned int size = 0; SANITY_CHECK((channel == AC97C_CHANNEL_A) || (channel == AC97C_CHANNEL_B) || (channel == AC97C_CHANNEL_CODEC)); switch (channel) { case AC97C_CHANNEL_CODEC: return 2; case AC97C_CHANNEL_A: size = (AT91C_BASE_AC97C->AC97C_CAMR & AT91C_AC97C_SIZE) >> 16; break; case AC97C_CHANNEL_B: size = (AT91C_BASE_AC97C->AC97C_CBMR & AT91C_AC97C_SIZE) >> 16; break; } if ((size & 2) != 0) { return 2; } else { return 4; } }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Sets the IOMUXC pin mux mode. This is an example to set the GPIO1_IO02 Pad as I2C1_SCL: */
static void _IOMUXC_SetPinMux(uint32_t muxRegister, uint32_t muxMode, uint32_t inputRegister, uint32_t inputDaisy, uint32_t configRegister, uint32_t inputOnfield)
/* Sets the IOMUXC pin mux mode. This is an example to set the GPIO1_IO02 Pad as I2C1_SCL: */ static void _IOMUXC_SetPinMux(uint32_t muxRegister, uint32_t muxMode, uint32_t inputRegister, uint32_t inputDaisy, uint32_t configRegister, uint32_t inputOnfield)
{ *((volatile uint32_t *)rt_ioremap((void*)muxRegister, 0x4)) = IOMUXC_SW_MUX_CTL_PAD_MUX_MODE(muxMode) | IOMUXC_SW_MUX_CTL_PAD_SION(inputOnfield); if (inputRegister) { *((volatile uint32_t *)rt_ioremap((void*)inputRegister, 0x4)) = IOMUXC_SELECT_INPUT_DAISY(inputDaisy); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Resets the SCSI Bus that the SCSI Controller is attached to. */
EFI_STATUS EFIAPI ScsiResetBus(IN EFI_SCSI_IO_PROTOCOL *This)
/* Resets the SCSI Bus that the SCSI Controller is attached to. */ EFI_STATUS EFIAPI ScsiResetBus(IN EFI_SCSI_IO_PROTOCOL *This)
{ SCSI_IO_DEV *ScsiIoDevice; ScsiIoDevice = SCSI_IO_DEV_FROM_THIS (This); REPORT_STATUS_CODE_WITH_DEVICE_PATH ( EFI_PROGRESS_CODE, (EFI_IO_BUS_ATA_ATAPI | EFI_IOB_PC_RESET), ScsiIoDevice->ScsiBusDeviceData->DevicePath ); if (ScsiIoDevice->ExtScsiSupport) { return ScsiIoDevice->ExtScsiPassThru->ResetChannel (ScsiIoDevice->ExtScsiPassThru); } else { return ScsiIoDevice->ScsiPassThru->ResetChannel (ScsiIoDevice->ScsiPassThru); } }
tianocore/edk2
C++
Other
4,240
/* (or various mixes of ':', '.', and '-') into a new ethernet address. Assumes 's' is well formed. */
u_char* pcap_ether_aton(const char *s)
/* (or various mixes of ':', '.', and '-') into a new ethernet address. Assumes 's' is well formed. */ u_char* pcap_ether_aton(const char *s)
{ register u_char *ep, *e; register u_char d; e = ep = (u_char *)malloc(6); if (e == NULL) return (NULL); while (*s) { if (*s == ':' || *s == '.' || *s == '-') s += 1; d = xdtoi(*s++); if (isxdigit((unsigned char)*s)) { d <<= 4; d |= xdtoi(*s++); } *ep++ = d; } return (e); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Also this lock is often released before a call that could block because reiserfs performances were partialy based on the release while schedule() property of the Bkl. */
void reiserfs_write_lock(struct super_block *s)
/* Also this lock is often released before a call that could block because reiserfs performances were partialy based on the release while schedule() property of the Bkl. */ void reiserfs_write_lock(struct super_block *s)
{ struct reiserfs_sb_info *sb_i = REISERFS_SB(s); if (sb_i->lock_owner != current) { mutex_lock(&sb_i->lock); sb_i->lock_owner = current; } sb_i->lock_depth++; }
robutest/uclinux
C++
GPL-2.0
60
/* Called as a tasklet when an event arrives from the L1. Read the event from where it's temporarily stored in SAL and call scdrv_dispatch_event() to send it on its way. Keep trying to read events until SAL indicates that there are no more immediately available. */
void scdrv_event(unsigned long)
/* Called as a tasklet when an event arrives from the L1. Read the event from where it's temporarily stored in SAL and call scdrv_dispatch_event() to send it on its way. Keep trying to read events until SAL indicates that there are no more immediately available. */ void scdrv_event(unsigned long)
{ int status; int len; unsigned long flags; struct subch_data_s *sd = event_sd; len = CHUNKSIZE; spin_lock_irqsave(&sd->sd_rlock, flags); status = ia64_sn_irtr_recv(sd->sd_nasid, sd->sd_subch, sd->sd_rb, &len); while (!(status < 0)) { spin_unlock_irqrestore(&sd->sd_rlock, flags); scdrv_dispatch_event(sd->sd_rb, len); len = CHUNKSIZE; spin_lock_irqsave(&sd->sd_rlock, flags); status = ia64_sn_irtr_recv(sd->sd_nasid, sd->sd_subch, sd->sd_rb, &len); } spin_unlock_irqrestore(&sd->sd_rlock, flags); }
robutest/uclinux
C++
GPL-2.0
60
/* If expression is a numeric constant, fills 'v' with its value and returns 1. Otherwise, returns 0. */
static int tonumeral(const expdesc *e, TValue *v)
/* If expression is a numeric constant, fills 'v' with its value and returns 1. Otherwise, returns 0. */ static int tonumeral(const expdesc *e, TValue *v)
{ case VKINT: if (v) setivalue(v, e->u.ival); return 1; case VKFLT: if (v) setfltvalue(v, e->u.nval); return 1; default: return 0; } }
Nicholas3388/LuaNode
C++
Other
1,055
/* This function will clear the handler to be called when a SysTick interrupt occurs. */
void SysTickIntUnregister(void)
/* This function will clear the handler to be called when a SysTick interrupt occurs. */ void SysTickIntUnregister(void)
{ HWREG(NVIC_ST_CTRL) &= ~(NVIC_ST_CTRL_INTEN); IntUnregister(FAULT_SYSTICK); }
watterott/WebRadio
C++
null
71
/* This function looks for a wear leveling entry with erase counter closest to @max and less then @max. */
static struct ubi_wl_entry* find_wl_entry(struct rb_root *root, int max)
/* This function looks for a wear leveling entry with erase counter closest to @max and less then @max. */ static struct ubi_wl_entry* find_wl_entry(struct rb_root *root, int max)
{ struct rb_node *p; struct ubi_wl_entry *e; e = rb_entry(rb_first(root), struct ubi_wl_entry, rb); max += e->ec; p = root->rb_node; while (p) { struct ubi_wl_entry *e1; e1 = rb_entry(p, struct ubi_wl_entry, rb); if (e1->ec >= max) p = p->rb_left; else { p = p->rb_right; e = e1; } } return e; }
EmcraftSystems/u-boot
C++
Other
181
/* This will search for a scmd pointer in the scsi_lookup array, returning the revelent smid. A returned value of zero means invalid. */
static u16 _scsih_scsi_lookup_find_by_scmd(struct MPT2SAS_ADAPTER *ioc, struct scsi_cmnd *scmd)
/* This will search for a scmd pointer in the scsi_lookup array, returning the revelent smid. A returned value of zero means invalid. */ static u16 _scsih_scsi_lookup_find_by_scmd(struct MPT2SAS_ADAPTER *ioc, struct scsi_cmnd *scmd)
{ u16 smid; unsigned long flags; int i; spin_lock_irqsave(&ioc->scsi_lookup_lock, flags); smid = 0; for (i = 0; i < ioc->scsiio_depth; i++) { if (ioc->scsi_lookup[i].scmd == scmd) { smid = ioc->scsi_lookup[i].smid; goto out; } } out: spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags); return smid; }
robutest/uclinux
C++
GPL-2.0
60
/* Calling g_mutex_unlock() on a mutex that is not locked by the current thread leads to undefined behaviour. */
void g_mutex_unlock(GMutex *mutex)
/* Calling g_mutex_unlock() on a mutex that is not locked by the current thread leads to undefined behaviour. */ void g_mutex_unlock(GMutex *mutex)
{ gint status; if G_UNLIKELY ((status = pthread_mutex_unlock (g_mutex_get_impl (mutex))) != 0) g_thread_abort (status, "pthread_mutex_unlock"); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Change the callback registered to all rx queues. */
ixEthAccQMgrRxCallbacksRegister(IxQMgrCallback ixQMgrCallback)
/* Change the callback registered to all rx queues. */ ixEthAccQMgrRxCallbacksRegister(IxQMgrCallback ixQMgrCallback)
{ IxEthAccQregInfo *qInfoDes; IxEthAccStatus ret = IX_ETH_ACC_SUCCESS; if (NULL == ixQMgrCallback) { ret = IX_ETH_ACC_FAIL; } for (qInfoDes = ixEthAccQmgrRxQueuesInfo; (qInfoDes->qCallback != (IxQMgrCallback) NULL ) && (ret == IX_ETH_ACC_SUCCESS); ++qInfoDes) { if (ixQMgrNotificationCallbackSet(qInfoDes->qId, ixQMgrCallback, qInfoDes->callbackTag ) != IX_SUCCESS) { ret = IX_ETH_ACC_FAIL; } } return(ret); }
EmcraftSystems/u-boot
C++
Other
181
/* Get the current state of a GPIO input pin */
static int a2f_gpio_get_value(struct gpio_chip *chip, unsigned gpio)
/* Get the current state of a GPIO input pin */ static int a2f_gpio_get_value(struct gpio_chip *chip, unsigned gpio)
{ struct a2f_gpio_chip *a2f_chip = container_of(chip, struct a2f_gpio_chip, chip); return (readl(a2f_chip->gpio_in) >> gpio) & 1; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* TBI: get time offset between scheduling timer ticks */
unsigned long mac_gettimeoffset(void)
/* TBI: get time offset between scheduling timer ticks */ unsigned long mac_gettimeoffset(void)
{ unsigned long ticks, offset = 0; ticks = via1[vT1CL] | (via1[vT1CH] << 8); if (ticks > MAC_CLOCK_TICK - MAC_CLOCK_TICK / 50) if (via1[vIFR] & 0x40) offset = TICK_SIZE; ticks = MAC_CLOCK_TICK - ticks; ticks = ticks * 10000L / MAC_CLOCK_TICK; return ticks + offset; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* All of the characters between quotes is replaced with spaces. */
VOID StripQuotes(IN OUT CHAR16 *TheString)
/* All of the characters between quotes is replaced with spaces. */ VOID StripQuotes(IN OUT CHAR16 *TheString)
{ BOOLEAN RemoveNow; for (RemoveNow = FALSE; TheString != NULL && *TheString != CHAR_NULL; TheString++) { if ((*TheString == L'^') && (*(TheString + 1) == L'\"')) { TheString++; } else if (*TheString == L'\"') { RemoveNow = (BOOLEAN) !RemoveNow; } else if (RemoveNow) { *TheString = L' '; } } }
tianocore/edk2
C++
Other
4,240
/* IDL long BrowserrQueryEmulatedDomains( IDL wchar_t *element_84, IDL TYPE_12 *element_85 ); */
static int dissect_browser_browserr_query_emulated_domains_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep)
/* IDL long BrowserrQueryEmulatedDomains( IDL wchar_t *element_84, IDL TYPE_12 *element_85 ); */ static int dissect_browser_browserr_query_emulated_domains_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep)
{ offset = dissect_ndr_str_pointer_item(tvb, offset, pinfo, tree, di, drep, NDR_POINTER_UNIQUE, "unknown string", hf_browser_unknown_string, 0); offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, di, drep, dissect_browser_TYPE_12, NDR_POINTER_REF, "unknown TYPE_12", -1); return offset; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* param base PDM base pointer. param handle PDM eDMA handle pointer. */
void PDM_TransferTerminateReceiveEDMA(PDM_Type *base, pdm_edma_handle_t *handle)
/* param base PDM base pointer. param handle PDM eDMA handle pointer. */ void PDM_TransferTerminateReceiveEDMA(PDM_Type *base, pdm_edma_handle_t *handle)
{ assert(handle != NULL); PDM_TransferAbortReceiveEDMA(base, handle); (void)memset(handle->tcd, 0, sizeof(edma_tcd_t) * handle->tcdNum); handle->tcdUser = 0U; handle->tcdUsedNum = 0U; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* For regular files, no data transfer shall occur past the offset maximum established in the open file description associated with aiocbp->aio_fildes. */
int aio_read(struct aiocb *cb)
/* For regular files, no data transfer shall occur past the offset maximum established in the open file description associated with aiocbp->aio_fildes. */ int aio_read(struct aiocb *cb)
{ rt_base_t level; if (!cb) return -EINVAL; if (cb->aio_offset < 0) return -EINVAL; level = rt_hw_interrupt_disable(); cb->aio_result = -EINPROGRESS; rt_hw_interrupt_enable(level); rt_work_init(&(cb->aio_work), aio_read_work, cb); rt_workqueue_dowork(aio_queue, &(cb->aio_work)); return 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Gets the instance from the base address to be used to gate or ungate the module clock. */
static uint32_t PIT_GetInstance(PIT_Type *base)
/* Gets the instance from the base address to be used to gate or ungate the module clock. */ static uint32_t PIT_GetInstance(PIT_Type *base)
{ uint32_t instance; for (instance = 0; instance < ARRAY_SIZE(s_pitBases); instance++) { if (s_pitBases[instance] == base) { break; } } assert(instance < ARRAY_SIZE(s_pitBases)); return instance; }
eclipse-threadx/getting-started
C++
Other
310
/* If the return value of the notifier can be and'ed with NOTIFY_STOP_MASK then atomic_notifier_call_chain() will return immediately, with the return value of the notifier function which halted execution. Otherwise the return value is the return value of the last notifier function called. */
int __kprobes __atomic_notifier_call_chain(struct atomic_notifier_head *nh, unsigned long val, void *v, int nr_to_call, int *nr_calls)
/* If the return value of the notifier can be and'ed with NOTIFY_STOP_MASK then atomic_notifier_call_chain() will return immediately, with the return value of the notifier function which halted execution. Otherwise the return value is the return value of the last notifier function called. */ int __kprobes __atomic_notifier_call_chain(struct atomic_notifier_head *nh, unsigned long val, void *v, int nr_to_call, int *nr_calls)
{ int ret; rcu_read_lock(); ret = notifier_call_chain(&nh->head, val, v, nr_to_call, nr_calls); rcu_read_unlock(); return ret; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Starts the LPTIM counter in the desired mode. */
void LPTIM_StartCounter(LPTIM_Module *LPTIMx, uint32_t OperatingMode)
/* Starts the LPTIM counter in the desired mode. */ void LPTIM_StartCounter(LPTIM_Module *LPTIMx, uint32_t OperatingMode)
{ MODIFY_REG(LPTIMx->CTRL, LPTIM_CTRL_TSTCM | LPTIM_CTRL_SNGMST, OperatingMode); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Called when there is data on the socket. */
void smb_data_ready(struct sock *sk, int len)
/* Called when there is data on the socket. */ void smb_data_ready(struct sock *sk, int len)
{ struct smb_sb_info *server = server_from_socket(sk->sk_socket); void (*data_ready)(struct sock *, int) = server->data_ready; data_ready(sk, len); VERBOSE("(%p, %d)\n", sk, len); smbiod_wake_up(); }
robutest/uclinux
C++
GPL-2.0
60
/* The RNC register determines the direction of the data transfer. It controls whether a configuration or readback take place. Writing to this register initiates the transfer. A value of 1 initiates a readback while writing a value of 0 initiates a configuration. */
static void buffer_icap_set_rnc(void __iomem *base_address, u32 data)
/* The RNC register determines the direction of the data transfer. It controls whether a configuration or readback take place. Writing to this register initiates the transfer. A value of 1 initiates a readback while writing a value of 0 initiates a configuration. */ static void buffer_icap_set_rnc(void __iomem *base_address, u32 data)
{ out_be32(base_address + XHI_RNC_REG_OFFSET, data); }
robutest/uclinux
C++
GPL-2.0
60
/* Check if DMA mode for transmission is enabled @rmtoll CR TXDMA LL_SWPMI_IsEnabledDMAReq_TX. */
uint32_t LL_SWPMI_IsEnabledDMAReq_TX(SWPMI_TypeDef *SWPMIx)
/* Check if DMA mode for transmission is enabled @rmtoll CR TXDMA LL_SWPMI_IsEnabledDMAReq_TX. */ uint32_t LL_SWPMI_IsEnabledDMAReq_TX(SWPMI_TypeDef *SWPMIx)
{ return ((READ_BIT(SWPMIx->CR, SWPMI_CR_TXDMA) == (SWPMI_CR_TXDMA)) ? 1UL : 0UL); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Selects the clock source to output on MCO1 pin or on MCO2 pin. */
void HAL_RCC_MCOConfig(uint32_t RCC_MCOx, uint32_t RCC_MCOSource, uint32_t RCC_MCODiv)
/* Selects the clock source to output on MCO1 pin or on MCO2 pin. */ void HAL_RCC_MCOConfig(uint32_t RCC_MCOx, uint32_t RCC_MCOSource, uint32_t RCC_MCODiv)
{ assert_param(IS_RCC_MCO(RCC_MCOx)); assert_param(IS_RCC_MCODIV(RCC_MCODiv)); if (RCC_MCOx == RCC_MCO1) { assert_param(IS_RCC_MCO1SOURCE(RCC_MCOSource)); __HAL_RCC_MCO1_CONFIGURE(RCC_MCOSource, RCC_MCODiv); __HAL_RCC_MCO1_ENABLE(); } else { assert_param(IS_RCC_MCO2SOURCE(RCC_MCOSource)); __HAL_RCC_MCO2_CONFIGURE(RCC_MCOSource, RCC_MCODiv); __HAL_RCC_MCO2_ENABLE(); } }
4ms/stm32mp1-baremetal
C++
Other
137
/* Get the I2C wake-up flag of the specified I2C port. The */
xtBoolean I2CWakeupStatusGet(unsigned long ulBase)
/* Get the I2C wake-up flag of the specified I2C port. The */ xtBoolean I2CWakeupStatusGet(unsigned long ulBase)
{ xASSERT((ulBase == I2C0_BASE) || (ulBase == I2C1_BASE)); return (xHWREG(ulBase + I2C_WKUPSTS)&I2C_WKUPSTS_WKUPIF) ? 1 : 0; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Will return the device's driver's name if it is bound to a device. If the device is not bound to a device, it will return the name of the bus it is attached to. If it is not attached to a bus either, an empty string will be returned. */
const char* dev_driver_string(const struct device *dev)
/* Will return the device's driver's name if it is bound to a device. If the device is not bound to a device, it will return the name of the bus it is attached to. If it is not attached to a bus either, an empty string will be returned. */ const char* dev_driver_string(const struct device *dev)
{ struct device_driver *drv; drv = ACCESS_ONCE(dev->driver); return drv ? drv->name : (dev->bus ? dev->bus->name : (dev->class ? dev->class->name : "")); }
robutest/uclinux
C++
GPL-2.0
60
/* Convert text to the binary representation of a device node. */
EFI_DEVICE_PATH_PROTOCOL* EFIAPI ConvertTextToDeviceNode(IN CONST CHAR16 *TextDeviceNode)
/* Convert text to the binary representation of a device node. */ EFI_DEVICE_PATH_PROTOCOL* EFIAPI ConvertTextToDeviceNode(IN CONST CHAR16 *TextDeviceNode)
{ return UefiDevicePathLibConvertTextToDeviceNode (TextDeviceNode); }
tianocore/edk2
C++
Other
4,240
/* FUNCTION: free uncommitted extended attributes from working map */
static void free_ea_wmap(struct inode *inode)
/* FUNCTION: free uncommitted extended attributes from working map */ static void free_ea_wmap(struct inode *inode)
{ dxd_t *ea = &JFS_IP(inode)->ea; if (ea->flag & DXD_EXTENT) { invalidate_dxd_metapages(inode, *ea); dbFree(inode, addressDXD(ea), lengthDXD(ea)); } ea->flag = 0; }
robutest/uclinux
C++
GPL-2.0
60
/* make a new node as following tree: new_node | node1__ \ node2 */
static struct finsh_node * make_sys_node(uint8_t type, struct finsh_node *node1, struct finsh_node *node2)
/* make a new node as following tree: new_node | node1__ \ node2 */ static struct finsh_node * make_sys_node(uint8_t type, struct finsh_node *node1, struct finsh_node *node2)
{ struct finsh_node* node; node = finsh_node_allocate(type); if ((node1 != NULL) && (node != NULL)) { finsh_node_child(node) = node1; finsh_node_sibling(node1) = node2; } else finsh_error_set(FINSH_ERROR_NULL_NODE); return node; }
pikasTech/PikaPython
C++
MIT License
1,403
/* This callback is called by the PCI subsystem whenever a PCI bus error is detected. */
static pci_ers_result_t qlge_io_error_detected(struct pci_dev *pdev, enum pci_channel_state state)
/* This callback is called by the PCI subsystem whenever a PCI bus error is detected. */ static pci_ers_result_t qlge_io_error_detected(struct pci_dev *pdev, enum pci_channel_state state)
{ struct net_device *ndev = pci_get_drvdata(pdev); switch (state) { case pci_channel_io_normal: return PCI_ERS_RESULT_CAN_RECOVER; case pci_channel_io_frozen: netif_device_detach(ndev); if (netif_running(ndev)) ql_eeh_close(ndev); pci_disable_device(pdev); return PCI_ERS_RESULT_NEED_RESET; case pci_channel_io_perm_failure: dev_err(&pdev->dev, "%s: pci_channel_io_perm_failure.\n", __func__); return PCI_ERS_RESULT_DISCONNECT; } return PCI_ERS_RESULT_NEED_RESET; }
robutest/uclinux
C++
GPL-2.0
60
/* Function to configure and enter in STOP 1 Mode. */
void EnterStop1Mode(void)
/* Function to configure and enter in STOP 1 Mode. */ void EnterStop1Mode(void)
{ LL_PWR_SetPowerMode(LL_PWR_MODE_STOP_MAINREGU); LL_LPM_EnableDeepSleep(); __WFI(); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* This file is part of the Simba project. */
static int test_input_single_frame(void)
/* This file is part of the Simba project. */ static int test_input_single_frame(void)
{ struct isotp_t isotp; uint8_t buf[8]; uint8_t frame[8]; BTASSERT(isotp_init(&isotp, &buf[0], sizeof(buf), 0) == 0); frame[0] = (0 << 4) | 3; frame[1] = 'f'; frame[2] = 'o'; frame[3] = 'o'; BTASSERT(isotp_input(&isotp, &frame[0], 4) == 3); BTASSERT(memcmp(&buf[0], "foo", 3) == 0); return (0); }
eerimoq/simba
C++
Other
337
/* Caller must hold the inotify_mutex of inode we are dealing with; it is expected to remove the old watch before unlocking the inode. */
s32 inotify_clone_watch(struct inotify_watch *old, struct inotify_watch *new)
/* Caller must hold the inotify_mutex of inode we are dealing with; it is expected to remove the old watch before unlocking the inode. */ s32 inotify_clone_watch(struct inotify_watch *old, struct inotify_watch *new)
{ struct inotify_handle *ih = old->ih; int ret = 0; new->mask = old->mask; new->ih = ih; mutex_lock(&ih->mutex); ret = inotify_handle_get_wd(ih, new); if (unlikely(ret)) goto out; ret = new->wd; get_inotify_handle(ih); new->inode = igrab(old->inode); list_add(&new->h_list, &ih->watches); list_add(&new->i_list, &old->inode->inotify_watches); out: mutex_unlock(&ih->mutex); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* ZigBee Device Profile dissector for the active endpoint list */
void dissect_zbee_zdp_req_active_ep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* ZigBee Device Profile dissector for the active endpoint list */ void dissect_zbee_zdp_req_active_ep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{ guint offset = 0; guint16 device; device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, sizeof(guint16), NULL); zbee_append_info(tree, pinfo, ", Device: 0x%04x", device); zdp_dump_excess(tvb, offset, pinfo, tree); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This is therefore much slower than need be, but is at least working. */
static void write_word(struct snd_emu8000 *emu, int *offset, unsigned short data)
/* This is therefore much slower than need be, but is at least working. */ static void write_word(struct snd_emu8000 *emu, int *offset, unsigned short data)
{ if (emu8000_reset_addr) { if (emu8000_reset_addr > 1) snd_emu8000_write_wait(emu); EMU8000_SMALW_WRITE(emu, *offset); } EMU8000_SMLD_WRITE(emu, data); *offset += 1; }
robutest/uclinux
C++
GPL-2.0
60
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
{ if(huart->Instance==LPUART1) { __HAL_RCC_LPUART1_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOA, GPIO_PIN_2|GPIO_PIN_3); } else if(huart->Instance==UART4) { __HAL_RCC_UART4_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOC, GPIO_PIN_10|GPIO_PIN_11); } else if(huart->Instance==USART1) { __HAL_RCC_USART1_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOC, USART1_TX_Pin|USART1_RX_Pin); } else if(huart->Instance==USART3) { __HAL_RCC_USART3_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOB, GPIO_PIN_10|GPIO_PIN_11); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns the number of bytes left in the input stream before the end, -1 in case of error. */
glong cr_input_get_nb_bytes_left(CRInput *a_this)
/* Returns the number of bytes left in the input stream before the end, -1 in case of error. */ glong cr_input_get_nb_bytes_left(CRInput *a_this)
{ g_return_val_if_fail (a_this && PRIVATE (a_this), -1); g_return_val_if_fail (PRIVATE (a_this)->nb_bytes <= PRIVATE (a_this)->in_buf_size, -1); g_return_val_if_fail (PRIVATE (a_this)->next_byte_index <= PRIVATE (a_this)->nb_bytes, -1); if (PRIVATE (a_this)->end_of_input) return 0; return PRIVATE (a_this)->nb_bytes - PRIVATE (a_this)->next_byte_index; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Shutdown everything and perform a clean reboot. This is not safe to call in interrupt context. */
void kernel_restart(char *cmd)
/* Shutdown everything and perform a clean reboot. This is not safe to call in interrupt context. */ void kernel_restart(char *cmd)
{ kernel_restart_prepare(cmd); if (!cmd) printk(KERN_EMERG "Restarting system.\n"); else printk(KERN_EMERG "Restarting system with command '%s'.\n", cmd); machine_restart(cmd); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Variable EC point multiplication. EcPointResult = EcPoint * BnPScalar. */
BOOLEAN EFIAPI EcPointMul(IN CONST VOID *EcGroup, OUT VOID *EcPointResult, IN CONST VOID *EcPoint, IN CONST VOID *BnPScalar, IN VOID *BnCtx)
/* Variable EC point multiplication. EcPointResult = EcPoint * BnPScalar. */ BOOLEAN EFIAPI EcPointMul(IN CONST VOID *EcGroup, OUT VOID *EcPointResult, IN CONST VOID *EcPoint, IN CONST VOID *BnPScalar, IN VOID *BnCtx)
{ return (BOOLEAN)EC_POINT_mul (EcGroup, EcPointResult, NULL, EcPoint, BnPScalar, BnCtx); }
tianocore/edk2
C++
Other
4,240
/* Set low 32 bits of Redirection Table entry. This routine writes the low-order 32 bits of a Redirection Table entry. */
static __pinned_func void ioApicRedSetLo(unsigned int irq, uint32_t lower32)
/* Set low 32 bits of Redirection Table entry. This routine writes the low-order 32 bits of a Redirection Table entry. */ static __pinned_func void ioApicRedSetLo(unsigned int irq, uint32_t lower32)
{ int32_t offset = IOAPIC_REDTBL + (irq << 1); __IoApicSet(offset, lower32); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Malloc_trim returns 1 if it actually released any memory, else 0. */
int dlmalloc_trim(size_t)
/* Malloc_trim returns 1 if it actually released any memory, else 0. */ int dlmalloc_trim(size_t)
{ result = sys_trim(gm, pad); POSTACTION(gm); } return result; }
DC-SWAT/DreamShell
C++
null
404
/* Set the slave select pins of the specified SPI port. The */
void SPISSSet(unsigned long ulBase, unsigned long ulSlaveSel)
/* Set the slave select pins of the specified SPI port. The */ void SPISSSet(unsigned long ulBase, unsigned long ulSlaveSel)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE) ); xASSERT((ulSlaveSel == SPI_SS_NONE) || (ulSlaveSel == SPI_SS0) || (ulSlaveSel == SPI_SS1) || (ulSlaveSel == SPI_SS0_SS1)); xHWREG(ulBase + SPI_SSR) &= ~SPI_SSR_SSR_M; xHWREG(ulBase + SPI_SSR) |= ulSlaveSel; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Sets the cursor to the specified row and column position. */
void samsungvfdSetCursor(uint8_t row, uint8_t col)
/* Sets the cursor to the specified row and column position. */ void samsungvfdSetCursor(uint8_t row, uint8_t col)
{ int row_offsets[] = { 0x00, 0x40, 0x14, 0x54 }; if ( row > samsungvfd_numlines ) { row = samsungvfd_numlines-1; } samsungvfd_command(SAMSUNGVFD_SETDDRAMADDR | (col + row_offsets[row])); }
microbuilder/LPC1343CodeBase
C++
Other
73
/* Find the highest existing bandwidth load for a given phase and period. */
static int uhci_highest_load(struct uhci_hcd *uhci, int phase, int period)
/* Find the highest existing bandwidth load for a given phase and period. */ static int uhci_highest_load(struct uhci_hcd *uhci, int phase, int period)
{ int highest_load = uhci->load[phase]; for (phase += period; phase < MAX_PHASE; phase += period) highest_load = max_t(int, highest_load, uhci->load[phase]); return highest_load; }
robutest/uclinux
C++
GPL-2.0
60
/* mpt_device_driver_register - Register device driver hooks @dd_cbfunc: driver callbacks struct @cb_idx: MPT protocol driver index */
int mpt_device_driver_register(struct mpt_pci_driver *dd_cbfunc, u8 cb_idx)
/* mpt_device_driver_register - Register device driver hooks @dd_cbfunc: driver callbacks struct @cb_idx: MPT protocol driver index */ int mpt_device_driver_register(struct mpt_pci_driver *dd_cbfunc, u8 cb_idx)
{ MPT_ADAPTER *ioc; const struct pci_device_id *id; if (!cb_idx || cb_idx >= MPT_MAX_PROTOCOL_DRIVERS) return -EINVAL; MptDeviceDriverHandlers[cb_idx] = dd_cbfunc; list_for_each_entry(ioc, &ioc_list, list) { id = ioc->pcidev->driver ? ioc->pcidev->driver->id_table : NULL; if (dd_cbfunc->probe) dd_cbfunc->probe(ioc->pcidev, id); } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Expand OFile by appending zero bytes at the end of OFile. */
EFI_STATUS FatExpandOFile(IN FAT_OFILE *OFile, IN UINT64 ExpandedSize)
/* Expand OFile by appending zero bytes at the end of OFile. */ EFI_STATUS FatExpandOFile(IN FAT_OFILE *OFile, IN UINT64 ExpandedSize)
{ EFI_STATUS Status; UINTN WritePos; WritePos = OFile->FileSize; Status = FatGrowEof (OFile, ExpandedSize); if (!EFI_ERROR (Status)) { Status = FatWriteZeroPool (OFile, WritePos); } return Status; }
tianocore/edk2
C++
Other
4,240
/* To skip this limit, boot/load with a large max_cstate limit. */
static int set_max_cstate(const struct dmi_system_id *id)
/* To skip this limit, boot/load with a large max_cstate limit. */ static int set_max_cstate(const struct dmi_system_id *id)
{ if (max_cstate > ACPI_PROCESSOR_MAX_POWER) return 0; printk(KERN_NOTICE PREFIX "%s detected - limiting to C%ld max_cstate." " Override with \"processor.max_cstate=%d\"\n", id->ident, (long)id->driver_data, ACPI_PROCESSOR_MAX_POWER + 1); max_cstate = (long)id->driver_data; return 0; }
robutest/uclinux
C++
GPL-2.0
60