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
/* Put a SNAP header on a frame and pass to 802.2 */
static int snap_request(struct datalink_proto *dl, struct sk_buff *skb, u8 *dest)
/* Put a SNAP header on a frame and pass to 802.2 */ static int snap_request(struct datalink_proto *dl, struct sk_buff *skb, u8 *dest)
{ memcpy(skb_push(skb, 5), dl->type, 5); llc_build_and_send_ui_pkt(snap_sap, skb, dest, snap_sap->laddr.lsap); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* clear the Tx window in the event of a failure */
static void rxrpc_clear_tx_window(struct rxrpc_call *call)
/* clear the Tx window in the event of a failure */ static void rxrpc_clear_tx_window(struct rxrpc_call *call)
{ rxrpc_rotate_tx_window(call, atomic_read(&call->sequence)); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Receives a byte that has been sent to the I2C Slave. */
unsigned long I2CSlaveDataGet(unsigned long ulBase)
/* Receives a byte that has been sent to the I2C Slave. */ unsigned long I2CSlaveDataGet(unsigned long ulBase)
{ ASSERT((ulBase == I2C0_SLAVE_BASE) || (ulBase == I2C1_SLAVE_BASE)); return(HWREG(ulBase + I2C_O_SDR)); }
watterott/WebRadio
C++
null
71
/* Fetch a POS value that was stored at boot time by the kernel when it scanned the MCA space. The register value is returned. Missing or invalid registers report 0. */
unsigned char mca_read_stored_pos(int slot, int reg)
/* Fetch a POS value that was stored at boot time by the kernel when it scanned the MCA space. The register value is returned. Missing or invalid registers report 0. */ unsigned char mca_read_stored_pos(int slot, int reg)
{ struct mca_device *mca_dev = mca_find_device_by_slot(slot); if(!mca_dev) return 0; return mca_device_read_stored_pos(mca_dev, reg); }
robutest/uclinux
C++
GPL-2.0
60
/* APIs to access CFPA pages Generic read function, used by customer to read data stored in 'Customer In-field Page'. */
status_t FFR_GetCustomerInfieldData(flash_config_t *config, uint8_t *pData, uint32_t offset, uint32_t len)
/* APIs to access CFPA pages Generic read function, used by customer to read data stored in 'Customer In-field Page'. */ status_t FFR_GetCustomerInfieldData(flash_config_t *config, uint8_t *pData, uint32_t offset, uint32_t len)
{ assert(BOOTLOADER_API_TREE_POINTER); return BOOTLOADER_API_TREE_POINTER->flashDriver->ffr_get_customer_infield_data(config, pData, offset, len); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* psmouse_activate() enables the mouse so that we get motion reports from it. */
static void psmouse_activate(struct psmouse *psmouse)
/* psmouse_activate() enables the mouse so that we get motion reports from it. */ static void psmouse_activate(struct psmouse *psmouse)
{ if (ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_ENABLE)) printk(KERN_WARNING "psmouse.c: Failed to enable mouse on %s\n", psmouse->ps2dev.serio->phys); psmouse_set_state(psmouse, PSMOUSE_ACTIVATED); }
robutest/uclinux
C++
GPL-2.0
60
/* multipath_end_bh_io() is called when we have finished servicing a multipathed operation and are ready to return a success/failure code to the buffer cache layer. */
static void multipath_end_bh_io(struct multipath_bh *mp_bh, int err)
/* multipath_end_bh_io() is called when we have finished servicing a multipathed operation and are ready to return a success/failure code to the buffer cache layer. */ static void multipath_end_bh_io(struct multipath_bh *mp_bh, int err)
{ struct bio *bio = mp_bh->master_bio; multipath_conf_t *conf = mp_bh->mddev->private; bio_endio(bio, err); mempool_free(mp_bh, conf->pool); }
robutest/uclinux
C++
GPL-2.0
60
/* Return a 32-bit mask indicating which cores are present on this SOC. */
__weak u32 cpu_mask(void)
/* Return a 32-bit mask indicating which cores are present on this SOC. */ __weak u32 cpu_mask(void)
{ ccsr_pic_t __iomem *pic = (void *)CONFIG_SYS_MPC8xxx_PIC_ADDR; struct cpu_type *cpu = gd->arch.cpu; if (cpu == &cpu_type_unknown) return ((in_be32(&pic->frr) & MPC8xxx_PICFRR_NCPU_MASK) >> MPC8xxx_PICFRR_NCPU_SHIFT) + 1; if (cpu->num_cores == 0) return compute_ppc_cpumask(); return cpu->mask; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Get the PDMA Current Byte Count of a channel. */
unsigned long PDMARemainTransferCountGet(unsigned long ulChannelID)
/* Get the PDMA Current Byte Count of a channel. */ unsigned long PDMARemainTransferCountGet(unsigned long ulChannelID)
{ xASSERT(xDMAChannelIDValid(ulChannelID)); return xHWREG(g_psDMAChannelAddress[ulChannelID] + PDMA_CBCR); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Returns the total number of free MPU regions available. */
u32 Xil_GetNumOfFreeRegions(void)
/* Returns the total number of free MPU regions available. */ u32 Xil_GetNumOfFreeRegions(void)
{ if (MPU_REG_DISABLED == Mpu_Config[Index].RegionStatus) { NumofFreeRegs++; } Index++; } return NumofFreeRegs; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Draws a number of pixels of the same color to the display This function is added by onelife. */
EMSTATUS DMD_writePixel(uint16_t x, uint16_t y, uint16_t color, uint32_t numPixels)
/* Draws a number of pixels of the same color to the display This function is added by onelife. */ EMSTATUS DMD_writePixel(uint16_t x, uint16_t y, uint16_t color, uint32_t numPixels)
{ uint32_t clipRemaining; uint32_t statusCode; if (!initialized){ return DMD_ERROR_DRIVER_NOT_INITIALIZED; } statusCode = setPixelAddress(x, y); if (statusCode != DMD_OK){ return statusCode; } clipRemaining = (dimensions.clipHeight - y - 1) * dimensions.clipWidth + dimensions.clipWidth - x; if (numPixels > clipRemaining){ return DMD_ERROR_TOO_MUCH_DATA; } DMDIF_prepareDataAccess( ); DMDIF_writeDataRepeated((uint32_t)color, numPixels); return DMD_OK; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function copies the current operational settings of this EFI UDPv6 Protocol instance into user-supplied buffers. This function is used optionally to retrieve the operational mode data of underlying networks or drivers. */
EFI_STATUS EFIAPI Udp6GetModeData(IN EFI_UDP6_PROTOCOL *This, OUT EFI_UDP6_CONFIG_DATA *Udp6ConfigData OPTIONAL, OUT EFI_IP6_MODE_DATA *Ip6ModeData OPTIONAL, OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL, OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL)
/* This function copies the current operational settings of this EFI UDPv6 Protocol instance into user-supplied buffers. This function is used optionally to retrieve the operational mode data of underlying networks or drivers. */ EFI_STATUS EFIAPI Udp6GetModeData(IN EFI_UDP6_PROTOCOL *This, OUT EFI_UDP6_CONFIG_DATA *Udp6ConfigData OPTIONAL, OUT EFI_IP6_MODE_DATA *Ip6ModeData OPTIONAL, OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL, OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL)
{ UDP6_INSTANCE_DATA *Instance; EFI_IP6_PROTOCOL *Ip; EFI_TPL OldTpl; EFI_STATUS Status; if (This == NULL) { return EFI_INVALID_PARAMETER; } Instance = UDP6_INSTANCE_DATA_FROM_THIS (This); if (!Instance->Configured && (Udp6ConfigData != NULL)) { return EFI_NOT_STARTED; } OldTpl = gBS->RaiseTPL (TPL_CALLBACK); if (Udp6ConfigData != NULL) { CopyMem (Udp6ConfigData, &Instance->ConfigData, sizeof (EFI_UDP6_CONFIG_DATA)); } Ip = Instance->IpInfo->Ip.Ip6; Status = Ip->GetModeData (Ip, Ip6ModeData, MnpConfigData, SnpModeData); gBS->RestoreTPL (OldTpl); return Status; }
tianocore/edk2
C++
Other
4,240
/* Function for initializing the ANT HRM profile instance. */
static ret_code_t ant_hrm_init(ant_hrm_profile_t *p_profile, ant_channel_config_t const *p_channel_config)
/* Function for initializing the ANT HRM profile instance. */ static ret_code_t ant_hrm_init(ant_hrm_profile_t *p_profile, ant_channel_config_t const *p_channel_config)
{ p_profile->channel_number = p_channel_config->channel_number; p_profile->page_0 = DEFAULT_ANT_HRM_PAGE0(); p_profile->page_1 = DEFAULT_ANT_HRM_PAGE1(); p_profile->page_2 = DEFAULT_ANT_HRM_PAGE2(); p_profile->page_3 = DEFAULT_ANT_HRM_PAGE3(); p_profile->page_4 = DEFAULT_ANT_HRM_PAGE4(); LOG_HRM("ANT HRM channel %u init\n\r", p_profile->channel_number); return ant_channel_init(p_channel_config); }
labapart/polymcu
C++
null
201
/* Returns: 0 on success, -ENOBUFS when we run out of space */
static int dump_holder(struct seq_file *seq, const struct gfs2_holder *gh)
/* Returns: 0 on success, -ENOBUFS when we run out of space */ static int dump_holder(struct seq_file *seq, const struct gfs2_holder *gh)
{ struct task_struct *gh_owner = NULL; char buffer[KSYM_SYMBOL_LEN]; char flags_buf[32]; sprint_symbol(buffer, gh->gh_ip); if (gh->gh_owner_pid) gh_owner = pid_task(gh->gh_owner_pid, PIDTYPE_PID); gfs2_print_dbg(seq, " H: s:%s f:%s e:%d p:%ld [%s] %s\n", state2str(gh->gh_state), hflags2str(flags_buf, gh->gh_flags, gh->gh_iflags), gh->gh_error, gh->gh_owner_pid ? (long)pid_nr(gh->gh_owner_pid) : -1, gh_owner ? gh_owner->comm : "(ended)", buffer); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Called by scsi stack when something has really gone wrong. Usually called when a command has timed-out for some reason. */
static int sbp2_scsi_abort(struct scsi_cmnd *cmd)
/* Called by scsi stack when something has really gone wrong. Usually called when a command has timed-out for some reason. */ static int sbp2_scsi_abort(struct scsi_cmnd *cmd)
{ struct sbp2_logical_unit *lu = cmd->device->hostdata; fw_notify("%s: sbp2_scsi_abort\n", lu->tgt->bus_id); sbp2_agent_reset(lu); sbp2_cancel_orbs(lu); return SUCCESS; }
robutest/uclinux
C++
GPL-2.0
60
/* efi_cin_check() - check if keyboard input is available */
static void efi_cin_check(void)
/* efi_cin_check() - check if keyboard input is available */ static void efi_cin_check(void)
{ efi_status_t ret; if (key_available) { efi_signal_event(efi_con_in.wait_for_key); return; } if (tstc()) { ret = efi_cin_read_key(&next_key); if (ret == EFI_SUCCESS) { key_available = true; efi_cin_notify(); if (key_available) efi_signal_event(efi_con_in.wait_for_key); } } }
4ms/stm32mp1-baremetal
C++
Other
137
/* DAC MSP Initialization This function configures the hardware resources used in this example. */
void HAL_DAC_MspInit(DAC_HandleTypeDef *hdac)
/* DAC MSP Initialization This function configures the hardware resources used in this example. */ void HAL_DAC_MspInit(DAC_HandleTypeDef *hdac)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; if(hdac->Instance==DAC1) { __HAL_RCC_DAC12_CLK_ENABLE(); __HAL_RCC_GPIOA_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_4; GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; GPIO_InitStruct.Pull = GPIO_NOPULL; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Call all network notifier blocks. Parameters and return value are as for raw_notifier_call_chain(). */
int call_netdevice_notifiers(unsigned long val, struct net_device *dev)
/* Call all network notifier blocks. Parameters and return value are as for raw_notifier_call_chain(). */ int call_netdevice_notifiers(unsigned long val, struct net_device *dev)
{ return raw_notifier_call_chain(&netdev_chain, val, dev); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Initialize an already allocated assemble table. This is generally the assemble table embedded in the IP6 service instance. */
VOID Ip6CreateAssembleTable(IN OUT IP6_ASSEMBLE_TABLE *Table)
/* Initialize an already allocated assemble table. This is generally the assemble table embedded in the IP6 service instance. */ VOID Ip6CreateAssembleTable(IN OUT IP6_ASSEMBLE_TABLE *Table)
{ UINT32 Index; for (Index = 0; Index < IP6_ASSEMLE_HASH_SIZE; Index++) { InitializeListHead (&Table->Bucket[Index]); } }
tianocore/edk2
C++
Other
4,240
/* Checks whether the specified RCC flag is set or not. */
FlagStatus RCC_GetFlagStatus(uint8_t RCC_FLAG)
/* Checks whether the specified RCC flag is set or not. */ FlagStatus RCC_GetFlagStatus(uint8_t RCC_FLAG)
{ uint32_t tmp = 0; uint32_t statusreg = 0; FlagStatus bitstatus = RESET; assert_param(IS_RCC_FLAG(RCC_FLAG)); tmp = RCC_FLAG >> 5; if (tmp == 0) { statusreg = RCC->CR; } else if (tmp == 1) { statusreg = RCC->BDCR; } else { statusreg = RCC->CSR; } tmp = RCC_FLAG & FLAG_MASK; if ((statusreg & ((uint32_t)1 << tmp)) != (uint32_t)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; }
avem-labs/Avem
C++
MIT License
1,752
/* ADC Enable The VBat Sensor. This enables the battery voltage measurements on channel 17. */
void adc_enable_vbat_sensor(void)
/* ADC Enable The VBat Sensor. This enables the battery voltage measurements on channel 17. */ void adc_enable_vbat_sensor(void)
{ ADC_CCR(ADC1) |= ADC_CCR_VBATEN; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Writes the data to flash through a flash block manager. Note that this function also checks that no data is programmed outside the flash memory region, so the bootloader can never be overwritten. */
blt_bool FlashWrite(blt_addr addr, blt_int32u len, blt_int8u *data)
/* Writes the data to flash through a flash block manager. Note that this function also checks that no data is programmed outside the flash memory region, so the bootloader can never be overwritten. */ blt_bool FlashWrite(blt_addr addr, blt_int32u len, blt_int8u *data)
{ blt_addr base_addr; if ((len - 1) > (FLASH_END_ADDRESS - addr)) { return BLT_FALSE; } if ((FlashGetSector(addr) == FLASH_INVALID_SECTOR) || \ (FlashGetSector(addr+len-1) == FLASH_INVALID_SECTOR)) { return BLT_FALSE; } base_addr = (addr/FLASH_WRITE_BLOCK_SIZE)*FLASH_WRITE_BLOCK_SIZE; if (base_addr == flashLayout[0].sector_start) { return FlashAddToBlock(&bootBlockInfo, addr, data, len); } return FlashAddToBlock(&blockInfo, addr, data, len); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* TIM_Base MSP Initialization This function configures the hardware resources used in this example. */
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim_base)
/* TIM_Base MSP Initialization This function configures the hardware resources used in this example. */ void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim_base)
{ if(htim_base->Instance==TIM2) { __HAL_RCC_TIM2_CLK_ENABLE(); } else if(htim_base->Instance==TIM14) { __HAL_RCC_TIM14_CLK_ENABLE(); } else if(htim_base->Instance==TIM16) { __HAL_RCC_TIM16_CLK_ENABLE(); } else if(htim_base->Instance==TIM17) { __HAL_RCC_TIM17_CLK_ENABLE(); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This API is used to get data high bandwidth in the register 0x13 bit 7. */
BMG160_RETURN_FUNCTION_TYPE bmg160_get_high_bw(u8 *v_high_bw_u8)
/* This API is used to get data high bandwidth in the register 0x13 bit 7. */ BMG160_RETURN_FUNCTION_TYPE bmg160_get_high_bw(u8 *v_high_bw_u8)
{ BMG160_RETURN_FUNCTION_TYPE comres = ERROR; u8 v_data_u8 = BMG160_INIT_VALUE; if (p_bmg160 == BMG160_NULL) { return E_BMG160_NULL_PTR; } else { comres = p_bmg160->BMG160_BUS_READ_FUNC(p_bmg160->dev_addr, BMG160_HIGH_BW__REG, &v_data_u8, BMG160_GEN_READ_WRITE_DATA_LENGTH); *v_high_bw_u8 = BMG160_GET_BITSLICE(v_data_u8, BMG160_HIGH_BW); } return comres; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* serio_destroy_port() completes deregistration process and removes port from the system */
static void serio_destroy_port(struct serio *serio)
/* serio_destroy_port() completes deregistration process and removes port from the system */ static void serio_destroy_port(struct serio *serio)
{ struct serio *child; child = serio_get_pending_child(serio); if (child) { serio_remove_pending_events(child); put_device(&child->dev); } if (serio->stop) serio->stop(serio); if (serio->parent) { serio_pause_rx(serio->parent); serio->parent->child = NULL; serio_continue_rx(serio->parent); serio->parent = NULL; } if (serio->registered) { sysfs_remove_group(&serio->dev.kobj, &serio_id_attr_group); device_del(&serio->dev); serio->registered = false; } list_del_init(&serio->node); serio_remove_pending_events(serio); put_device(&serio->dev); }
robutest/uclinux
C++
GPL-2.0
60
/* Match the calling driver type against the table. Returns: 0 if the device matches. */
int usb_usual_check_type(const struct usb_device_id *id, int caller_type)
/* Match the calling driver type against the table. Returns: 0 if the device matches. */ int usb_usual_check_type(const struct usb_device_id *id, int caller_type)
{ int id_type = USB_US_TYPE(id->driver_info); if (caller_type <= 0 || caller_type >= 3) return -EINVAL; if (id_type == caller_type) return 0; if (id_type == USB_US_TYPE_NONE && caller_type == atomic_read(&usu_bias)) return 0; return -ENODEV; }
robutest/uclinux
C++
GPL-2.0
60
/* at91_rx_overflow_err - send error frame due to rx overflow @dev: net device */
static void at91_rx_overflow_err(struct net_device *dev)
/* at91_rx_overflow_err - send error frame due to rx overflow @dev: net device */ static void at91_rx_overflow_err(struct net_device *dev)
{ struct net_device_stats *stats = &dev->stats; struct sk_buff *skb; struct can_frame *cf; dev_dbg(dev->dev.parent, "RX buffer overflow\n"); stats->rx_over_errors++; stats->rx_errors++; skb = alloc_can_err_skb(dev, &cf); if (unlikely(!skb)) return; cf->can_id |= CAN_ERR_CRTL; cf->data[1] = CAN_ERR_CRTL_RX_OVERFLOW; netif_receive_skb(skb); stats->rx_packets++; stats->rx_bytes += cf->can_dlc; }
robutest/uclinux
C++
GPL-2.0
60
/* Get timer counter value. This function is used to get timer clock counter value. */
unsigned long TimerLoadGet(unsigned long ulBase)
/* Get timer counter value. This function is used to get timer clock counter value. */ unsigned long TimerLoadGet(unsigned long ulBase)
{ xASSERT((ulBase == TIMER0_BASE) || (ulBase == TIMER1_BASE) || (ulBase == TIMER2_BASE) || (ulBase == TIMER3_BASE) ); return (xHWREG(ulBase + TIMER_TC)); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* If the requested operation results in an overflow or an underflow condition, then Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeUint8Add(IN UINT8 Augend, IN UINT8 Addend, OUT UINT8 *Result)
/* If the requested operation results in an overflow or an underflow condition, then Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ RETURN_STATUS EFIAPI SafeUint8Add(IN UINT8 Augend, IN UINT8 Addend, OUT UINT8 *Result)
{ RETURN_STATUS Status; if (Result == NULL) { return RETURN_INVALID_PARAMETER; } if (((UINT8)(Augend + Addend)) >= Augend) { *Result = (UINT8)(Augend + Addend); Status = RETURN_SUCCESS; } else { *Result = UINT8_ERROR; Status = RETURN_BUFFER_TOO_SMALL; } return Status; }
tianocore/edk2
C++
Other
4,240
/* Sets the link speed in the AUTOC register in the MAC and restarts link. */
static s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw, ixgbe_link_speed speed, bool autoneg, bool autoneg_wait_to_complete)
/* Sets the link speed in the AUTOC register in the MAC and restarts link. */ static s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw, ixgbe_link_speed speed, bool autoneg, bool autoneg_wait_to_complete)
{ s32 status; status = hw->phy.ops.setup_link_speed(hw, speed, autoneg, autoneg_wait_to_complete); ixgbe_start_mac_link_82598(hw, autoneg_wait_to_complete); return status; }
robutest/uclinux
C++
GPL-2.0
60
/* The maximum interval of time (1 LSB = 1/ODR) that can elapse after the end of the latency interval in which the click-detection procedure can start, in cases where the device is configured for double-click detection.. */
int32_t lis2dh12_double_tap_timeout_get(stmdev_ctx_t *ctx, uint8_t *val)
/* The maximum interval of time (1 LSB = 1/ODR) that can elapse after the end of the latency interval in which the click-detection procedure can start, in cases where the device is configured for double-click detection.. */ int32_t lis2dh12_double_tap_timeout_get(stmdev_ctx_t *ctx, uint8_t *val)
{ lis2dh12_time_window_t time_window; int32_t ret; ret = lis2dh12_read_reg(ctx, LIS2DH12_TIME_WINDOW, (uint8_t *)&time_window, 1); *val = (uint8_t)time_window.tw; return ret; }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Return a pointer to a NORFLASH_Info_TypeDef, which contain vital flash device information. */
NORFLASH_Info_TypeDef* NORFLASH_DeviceInfo(void)
/* Return a pointer to a NORFLASH_Info_TypeDef, which contain vital flash device information. */ NORFLASH_Info_TypeDef* NORFLASH_DeviceInfo(void)
{ if (!flashInitialized) { if (flashInterrogate() != NORFLASH_STATUS_OK) return NULL; } return &flashInfo; }
remotemcu/remcu-chip-sdks
C++
null
436
/* On success, We end up with an outstanding reference count against iloc->bh. This */
int ext3_reserve_inode_write(handle_t *handle, struct inode *inode, struct ext3_iloc *iloc)
/* On success, We end up with an outstanding reference count against iloc->bh. This */ int ext3_reserve_inode_write(handle_t *handle, struct inode *inode, struct ext3_iloc *iloc)
{ int err = 0; if (handle) { err = ext3_get_inode_loc(inode, iloc); if (!err) { BUFFER_TRACE(iloc->bh, "get_write_access"); err = ext3_journal_get_write_access(handle, iloc->bh); if (err) { brelse(iloc->bh); iloc->bh = NULL; } } } ext3_std_error(inode->i_sb, err); return err; }
robutest/uclinux
C++
GPL-2.0
60
/* This function name is required because a script is used to find these routines and create the code that calls these routines. */
void proto_reg_handoff_fip(void)
/* This function name is required because a script is used to find these routines and create the code that calls these routines. */ void proto_reg_handoff_fip(void)
{ dissector_handle_t fip_handle; fip_handle = create_dissector_handle(dissect_fip, proto_fip); dissector_add_uint("ethertype", ETHERTYPE_FIP, fip_handle); fc_handle = find_dissector_add_dependency("fc", proto_fip); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Deselects the specified ADC channel as an AWD channel. */
void ADC_AWD_DeselectCh(CM_ADC_TypeDef *ADCx, uint8_t u8AwdUnit, uint8_t u8Ch)
/* Deselects the specified ADC channel as an AWD channel. */ void ADC_AWD_DeselectCh(CM_ADC_TypeDef *ADCx, uint8_t u8AwdUnit, uint8_t u8Ch)
{ DDL_ASSERT(IS_ADC_CH(ADCx, u8Ch)); (void)(u8AwdUnit); CLR_REG32_BIT(ADCx->AWDCHSR, 1UL << u8Ch); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* get the number of missed frames during receiving */
void enet_missed_frame_counter_get(uint32_t *rxfifo_drop, uint32_t *rxdma_drop)
/* get the number of missed frames during receiving */ void enet_missed_frame_counter_get(uint32_t *rxfifo_drop, uint32_t *rxdma_drop)
{ uint32_t temp_counter = 0U; temp_counter = ENET_DMA_MFBOCNT; *rxfifo_drop = GET_DMA_MFBOCNT_MSFA(temp_counter); *rxdma_drop = GET_DMA_MFBOCNT_MSFC(temp_counter); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If the allocation of the new buffer is successful and the smaller of NewSize and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT(). */
VOID* InternalReallocatePool(IN EFI_MEMORY_TYPE PoolType, IN UINTN OldSize, IN UINTN NewSize, IN VOID *OldBuffer OPTIONAL)
/* If the allocation of the new buffer is successful and the smaller of NewSize and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT(). */ VOID* InternalReallocatePool(IN EFI_MEMORY_TYPE PoolType, IN UINTN OldSize, IN UINTN NewSize, IN VOID *OldBuffer OPTIONAL)
{ VOID *NewBuffer; NewBuffer = InternalAllocateZeroPool (PoolType, NewSize); if ((NewBuffer != NULL) && (OldBuffer != NULL)) { CopyMem (NewBuffer, OldBuffer, MIN (OldSize, NewSize)); FreePool (OldBuffer); } return NewBuffer; }
tianocore/edk2
C++
Other
4,240
/* Let kernel threads use this to say that they allow a certain signal. Must not be used if kthread was cloned with CLONE_SIGHAND. */
int allow_signal(int sig)
/* Let kernel threads use this to say that they allow a certain signal. Must not be used if kthread was cloned with CLONE_SIGHAND. */ int allow_signal(int sig)
{ if (!valid_signal(sig) || sig < 1) return -EINVAL; spin_lock_irq(&current->sighand->siglock); sigdelset(&current->blocked, sig); current->sighand->action[(sig)-1].sa.sa_handler = (void __user *)2; recalc_sigpending(); spin_unlock_irq(&current->sighand->siglock); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Check whether the RX ring buffer is full. @parram handle LPSCI handle pointer. */
static bool LPSCI_TransferIsRxRingBufferFull(lpsci_handle_t *handle)
/* Check whether the RX ring buffer is full. @parram handle LPSCI handle pointer. */ static bool LPSCI_TransferIsRxRingBufferFull(lpsci_handle_t *handle)
{ assert(handle); bool full; if (LPSCI_TransferGetRxRingBufferLength(handle) == (handle->rxRingBufferSize - 1U)) { full = true; } else { full = false; } return full; }
labapart/polymcu
C++
null
201
/* A packet arrived via ISDN. Search interface-chain for a corresponding interface. If found, deliver packet to receiver-function and return 1, else return 0. */
int isdn_net_rcv_skb(int idx, struct sk_buff *skb)
/* A packet arrived via ISDN. Search interface-chain for a corresponding interface. If found, deliver packet to receiver-function and return 1, else return 0. */ int isdn_net_rcv_skb(int idx, struct sk_buff *skb)
{ isdn_net_dev *p = dev->rx_netdev[idx]; if (p) { isdn_net_local *lp = p->local; if ((lp->flags & ISDN_NET_CONNECTED) && (!lp->dialstate)) { isdn_net_receive(p->dev, skb); return 1; } } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* If there is no additional space for HOB creation, then ASSERT(). */
VOID EFIAPI BuildResourceDescriptorWithOwnerHob(IN EFI_RESOURCE_TYPE ResourceType, IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute, IN EFI_PHYSICAL_ADDRESS PhysicalStart, IN UINT64 NumberOfBytes, IN EFI_GUID *OwnerGUID)
/* If there is no additional space for HOB creation, then ASSERT(). */ VOID EFIAPI BuildResourceDescriptorWithOwnerHob(IN EFI_RESOURCE_TYPE ResourceType, IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute, IN EFI_PHYSICAL_ADDRESS PhysicalStart, IN UINT64 NumberOfBytes, IN EFI_GUID *OwnerGUID)
{ EFI_HOB_RESOURCE_DESCRIPTOR *Hob; Hob = InternalPeiCreateHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, (UINT16)sizeof (EFI_HOB_RESOURCE_DESCRIPTOR)); if (Hob == NULL) { return; } Hob->ResourceType = ResourceType; Hob->ResourceAttribute = ResourceAttribute; Hob->PhysicalStart = PhysicalStart; Hob->ResourceLength = NumberOfBytes; CopyGuid (&Hob->Owner, OwnerGUID); }
tianocore/edk2
C++
Other
4,240
/* Disable the Capture of the PWM module. The */
void PWMCAPDisable(unsigned long ulBase, unsigned long ulChannel)
/* Disable the Capture of the PWM module. The */ void PWMCAPDisable(unsigned long ulBase, unsigned long ulChannel)
{ unsigned long ulChannelTemp; ulChannelTemp = (ulBase == PWMA_BASE) ? ulChannel : (ulChannel - 4); xASSERT((ulBase == PWMA_BASE) || (ulBase == PWMB_BASE)); xASSERT(((ulChannelTemp >= 0) || (ulChannelTemp <= 3))); xHWREG(ulBase + PWM_CCR0 + (ulChannelTemp >> 1)*4) &= ~(PWM_CCR0_CAPCH0EN << ((ulChannel % 2) ? 16 : 0)); xHWREG(ulBase + PWM_PCR) &= ~(PWM_PCR_CH0EN << (ulChannelTemp << 3)); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* The Poll() function can be used by network drivers and applications to increase the rate that data packets are moved between the communications device and the transmit and receive queues. In some systems, the periodic timer event in the managed network driver may not poll the underlying communications device fast enough to transmit and/or receive all data packets without missing incoming packets or dropping outgoing packets. Drivers and applications that are experiencing packet loss should try calling the Poll() function more often. */
EFI_STATUS EFIAPI EfiMtftp4Poll(IN EFI_MTFTP4_PROTOCOL *This)
/* The Poll() function can be used by network drivers and applications to increase the rate that data packets are moved between the communications device and the transmit and receive queues. In some systems, the periodic timer event in the managed network driver may not poll the underlying communications device fast enough to transmit and/or receive all data packets without missing incoming packets or dropping outgoing packets. Drivers and applications that are experiencing packet loss should try calling the Poll() function more often. */ EFI_STATUS EFIAPI EfiMtftp4Poll(IN EFI_MTFTP4_PROTOCOL *This)
{ MTFTP4_PROTOCOL *Instance; EFI_UDP4_PROTOCOL *Udp; EFI_STATUS Status; if (This == NULL) { return EFI_INVALID_PARAMETER; } Instance = MTFTP4_PROTOCOL_FROM_THIS (This); if (Instance->State == MTFTP4_STATE_UNCONFIGED) { return EFI_NOT_STARTED; } else if (Instance->State == MTFTP4_STATE_DESTROY) { return EFI_DEVICE_ERROR; } Udp = Instance->UnicastPort->Protocol.Udp4; Status = Udp->Poll (Udp); Mtftp4OnTimerTick (NULL, Instance->Service); return Status; }
tianocore/edk2
C++
Other
4,240
/* this function is a POSIX compliant version, which will return current location in directory stream. */
long telldir(DIR *d)
/* this function is a POSIX compliant version, which will return current location in directory stream. */ long telldir(DIR *d)
{ struct dfs_fd *fd; long result; fd = fd_get(d->fd); if (fd == NULL) { rt_set_errno(-EBADF); return 0; } result = fd->pos - d->num + d->cur; fd_put(fd); return result; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Configure the packet. See the data sheet for details. */
void radio_configure_packet(uint8_t lf_len_bits, uint8_t s0_len_bytes, uint8_t s1_len_bits)
/* Configure the packet. See the data sheet for details. */ void radio_configure_packet(uint8_t lf_len_bits, uint8_t s0_len_bytes, uint8_t s1_len_bits)
{ RADIO_PCNF0 = RADIO_PCNF0_LFLEN_MASKED(lf_len_bits) | RADIO_PCNF0_S0LEN_MASKED(s0_len_bytes) | RADIO_PCNF0_S1LEN_MASKED(s1_len_bits); }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* param base I2S peripheral base address. param handle Pointer to usart_dma_handle_t structure. param xfer I2S DMA transfer structure. See #i2s_transfer_t. param i2s_channel I2S start channel number retval kStatus_Success */
status_t I2S_TransferReceiveLoopDMA(I2S_Type *base, i2s_dma_handle_t *handle, i2s_transfer_t *xfer, uint32_t loopTransferCount)
/* param base I2S peripheral base address. param handle Pointer to usart_dma_handle_t structure. param xfer I2S DMA transfer structure. See #i2s_transfer_t. param i2s_channel I2S start channel number retval kStatus_Success */ status_t I2S_TransferReceiveLoopDMA(I2S_Type *base, i2s_dma_handle_t *handle, i2s_transfer_t *xfer, uint32_t loopTransferCount)
{ assert(handle != NULL); assert(handle->i2sLoopDMADescriptor != NULL); handle->state = (uint32_t)kI2S_DmaStateRx; return I2S_TransferLoopDMA(base, handle, xfer, loopTransferCount); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* tells whether a key or value can be cleared from a weak table. Non-collectable objects are never removed from weak tables. Strings behave as */
static int iscleared(global_State *g, const TValue *o)
/* tells whether a key or value can be cleared from a weak table. Non-collectable objects are never removed from weak tables. Strings behave as */ static int iscleared(global_State *g, const TValue *o)
{ markobject(g, rawtsvalue(o)); return 0; } else return iswhite(gcvalue(o)); }
opentx/opentx
C++
GNU General Public License v2.0
2,025
/* release_resource - release a previously reserved resource @old: resource pointer */
int release_resource(struct resource *old)
/* release_resource - release a previously reserved resource @old: resource pointer */ int release_resource(struct resource *old)
{ int retval; write_lock(&resource_lock); retval = __release_resource(old); write_unlock(&resource_lock); return retval; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This can be called directly from usb_submit_urb (while we have the sc->lock taken) and from an interrupt (while we do NOT have the sc->lock taken). Therefore, bounce this off to a tasklet. */
static void ub_urb_complete(struct urb *urb)
/* This can be called directly from usb_submit_urb (while we have the sc->lock taken) and from an interrupt (while we do NOT have the sc->lock taken). Therefore, bounce this off to a tasklet. */ static void ub_urb_complete(struct urb *urb)
{ struct ub_dev *sc = urb->context; ub_complete(&sc->work_done); tasklet_schedule(&sc->tasklet); }
robutest/uclinux
C++
GPL-2.0
60
/* Changes the master device of the slave. Pass NULL to break the bonding. The caller must hold the RTNL semaphore. On a failure a negative errno code is returned. On success the reference counts are adjusted, RTM_NEWLINK is sent to the routing socket and the function returns zero. */
int netdev_set_master(struct net_device *slave, struct net_device *master)
/* Changes the master device of the slave. Pass NULL to break the bonding. The caller must hold the RTNL semaphore. On a failure a negative errno code is returned. On success the reference counts are adjusted, RTM_NEWLINK is sent to the routing socket and the function returns zero. */ int netdev_set_master(struct net_device *slave, struct net_device *master)
{ struct net_device *old = slave->master; ASSERT_RTNL(); if (master) { if (old) return -EBUSY; dev_hold(master); } slave->master = master; synchronize_net(); if (old) dev_put(old); if (master) slave->flags |= IFF_SLAVE; else slave->flags &= ~IFF_SLAVE; rtmsg_ifinfo(RTM_NEWLINK, slave, IFF_SLAVE); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Build AUX data to set current voltage swing and pre-emphasis level settings; the necessary data is taken from the */
static void set_vswing_preemp(struct udevice *dev, u8 *aux_data)
/* Build AUX data to set current voltage swing and pre-emphasis level settings; the necessary data is taken from the */ static void set_vswing_preemp(struct udevice *dev, u8 *aux_data)
{ struct dp_tx *dp_tx = dev_get_priv(dev); u8 data; u8 vs_level_rx = dp_tx->link_config.vs_level; u8 pe_level_rx = dp_tx->link_config.pe_level; data = (pe_level_rx << DPCD_TRAINING_LANEX_SET_PE_SHIFT) | vs_level_rx; if (vs_level_rx == MAXIMUM_VS_LEVEL) data |= DPCD_TRAINING_LANEX_SET_MAX_VS_MASK; if (pe_level_rx == MAXIMUM_PE_LEVEL) data |= DPCD_TRAINING_LANEX_SET_MAX_PE_MASK; memset(aux_data, data, 4); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Polls the 'busy' register until the command is complete. NOTE: Assumes data->lock is held. */
static void pmcmsptwi_poll_complete(struct pmcmsptwi_data *data)
/* Polls the 'busy' register until the command is complete. NOTE: Assumes data->lock is held. */ static void pmcmsptwi_poll_complete(struct pmcmsptwi_data *data)
{ int i; for (i = 0; i < MSP_MAX_POLL; i++) { u32 val = pmcmsptwi_readl(data->iobase + MSP_TWI_BUSY_REG_OFFSET); if (val == 0) { u32 reason = pmcmsptwi_readl(data->iobase + MSP_TWI_INT_STS_REG_OFFSET); pmcmsptwi_writel(reason, data->iobase + MSP_TWI_INT_STS_REG_OFFSET); data->last_result = pmcmsptwi_get_result(reason); return; } udelay(MSP_POLL_DELAY); } dev_dbg(&pmcmsptwi_adapter.dev, "Result: Poll timeout\n"); data->last_result = MSP_TWI_XFER_TIMEOUT; }
robutest/uclinux
C++
GPL-2.0
60
/* Adjust the base and number of pages to really allocate according to Guard. */
VOID AdjustMemoryA(IN OUT EFI_PHYSICAL_ADDRESS *Memory, IN OUT UINTN *NumberOfPages)
/* Adjust the base and number of pages to really allocate according to Guard. */ VOID AdjustMemoryA(IN OUT EFI_PHYSICAL_ADDRESS *Memory, IN OUT UINTN *NumberOfPages)
{ if (!IsGuardPage (*Memory + EFI_PAGES_TO_SIZE (*NumberOfPages))) { *NumberOfPages += 1; } if (!IsGuardPage (*Memory - EFI_PAGE_SIZE)) { *Memory -= EFI_PAGE_SIZE; *NumberOfPages += 1; } }
tianocore/edk2
C++
Other
4,240
/* Returns %0 on success and a negative error value otherwise. */
int crw_register_handler(int rsc, crw_handler_t handler)
/* Returns %0 on success and a negative error value otherwise. */ int crw_register_handler(int rsc, crw_handler_t handler)
{ int rc = 0; if ((rsc < 0) || (rsc >= NR_RSCS)) return -EINVAL; mutex_lock(&crw_handler_mutex); if (crw_handlers[rsc]) rc = -EBUSY; else crw_handlers[rsc] = handler; mutex_unlock(&crw_handler_mutex); return rc; }
robutest/uclinux
C++
GPL-2.0
60
/* Rotate array buf of length 'len' to the left (towards low indices) by 'num' bytes if ctl is 1; otherwise, leave it unchanged. This is constant-time. 'num' MUST be lower than 'len'. 'len' MUST be lower than or equal to 64. */
static void cond_rotate(uint32_t ctl, unsigned char *buf, size_t len, size_t num)
/* Rotate array buf of length 'len' to the left (towards low indices) by 'num' bytes if ctl is 1; otherwise, leave it unchanged. This is constant-time. 'num' MUST be lower than 'len'. 'len' MUST be lower than or equal to 64. */ static void cond_rotate(uint32_t ctl, unsigned char *buf, size_t len, size_t num)
{ unsigned char tmp[64]; size_t u, v; for (u = 0, v = num; u < len; u ++) { tmp[u] = MUX(ctl, buf[v], buf[u]); if (++ v == len) { v = 0; } } memcpy(buf, tmp, len); }
RavenSystem/esp-homekit-devices
C++
Other
2,577
/* Clear the time-base counter reached its maximum value flag of selected channel. */
void BPWM_ClearWrapAroundFlag(BPWM_T *bpwm, uint32_t u32ChannelNum)
/* Clear the time-base counter reached its maximum value flag of selected channel. */ void BPWM_ClearWrapAroundFlag(BPWM_T *bpwm, uint32_t u32ChannelNum)
{ (void)u32ChannelNum; (bpwm)->STATUS = BPWM_STATUS_CNTMAX0_Msk; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Get maximum number of messages in a Message Queue. */
static uint32_t svcRtxMessageQueueGetCapacity(osMessageQueueId_t mq_id)
/* Get maximum number of messages in a Message Queue. */ static uint32_t svcRtxMessageQueueGetCapacity(osMessageQueueId_t mq_id)
{ EvrRtxMessageQueueGetCapacity(mq, 0U); return 0U; } EvrRtxMessageQueueGetCapacity(mq, mq->mp_info.max_blocks); return mq->mp_info.max_blocks; }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT32 EFIAPI PciBitFieldAnd32(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 AndData)
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ UINT32 EFIAPI PciBitFieldAnd32(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 AndData)
{ return PciCf8BitFieldAnd32 (Address, StartBit, EndBit, AndData); }
tianocore/edk2
C++
Other
4,240
/* Set the specified DMA Rx Desc Own bit. */
void ETH_SetDmaRxDescOwn(ETH_DMADescType *DMARxDesc)
/* Set the specified DMA Rx Desc Own bit. */ void ETH_SetDmaRxDescOwn(ETH_DMADescType *DMARxDesc)
{ DMARxDesc->Status |= ETH_DMA_RX_DESC_OWN; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Just figures out what the actual struct drm_device associated with @dev is and calls its suspend hook, if present. */
static int drm_class_suspend(struct device *dev, pm_message_t state)
/* Just figures out what the actual struct drm_device associated with @dev is and calls its suspend hook, if present. */ static int drm_class_suspend(struct device *dev, pm_message_t state)
{ if (dev->type == &drm_sysfs_device_minor) { struct drm_minor *drm_minor = to_drm_minor(dev); struct drm_device *drm_dev = drm_minor->dev; if (drm_minor->type == DRM_MINOR_LEGACY && !drm_core_check_feature(drm_dev, DRIVER_MODESET) && drm_dev->driver->suspend) return drm_dev->driver->suspend(drm_dev, state); } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Diaables the Flash Power Down in STOP mode. */
void PMU_DisableFlashPowerDown(void)
/* Diaables the Flash Power Down in STOP mode. */ void PMU_DisableFlashPowerDown(void)
{ PMU->CTRL_B.FPDSM = DISABLE ; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Used for upper level protocols to time out the exchange. */
static void fc_exch_timer_set_locked(struct fc_exch *ep, unsigned int timer_msec)
/* Used for upper level protocols to time out the exchange. */ static void fc_exch_timer_set_locked(struct fc_exch *ep, unsigned int timer_msec)
{ if (ep->state & (FC_EX_RST_CLEANUP | FC_EX_DONE)) return; FC_EXCH_DBG(ep, "Exchange timer armed\n"); if (queue_delayed_work(fc_exch_workqueue, &ep->timeout_work, msecs_to_jiffies(timer_msec))) fc_exch_hold(ep); }
robutest/uclinux
C++
GPL-2.0
60
/* Change the LSM file creation context in a set of credentials to be the same as the object context of the specified inode, so that the new inodes have the same MAC context as that inode. */
int set_create_files_as(struct cred *new, struct inode *inode)
/* Change the LSM file creation context in a set of credentials to be the same as the object context of the specified inode, so that the new inodes have the same MAC context as that inode. */ int set_create_files_as(struct cred *new, struct inode *inode)
{ new->fsuid = inode->i_uid; new->fsgid = inode->i_gid; return security_kernel_create_files_as(new, inode); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* 10. Redial No data 10. Network-initiated Service Upgrade indicator No data 8.1.4.1 3GPP TS 24.011 version 6.1.0 Release 6 */
static guint16 de_cp_user_data(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
/* 10. Redial No data 10. Network-initiated Service Upgrade indicator No data 8.1.4.1 3GPP TS 24.011 version 6.1.0 Release 6 */ static guint16 de_cp_user_data(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
{ guint32 curr_offset; tvbuff_t *rp_tvb; curr_offset = offset; proto_tree_add_bytes_format(tree, hf_gsm_a_dtap_rpdu, tvb, curr_offset, len, NULL, "RPDU (not displayed)"); rp_tvb = tvb_new_subset_length(tvb, curr_offset, len); call_dissector(rp_handle, rp_tvb, pinfo, g_tree); curr_offset += len; EXTRANEOUS_DATA_CHECK(len, curr_offset - offset, pinfo, &ei_gsm_a_dtap_extraneous_data); return (curr_offset - offset); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Convenience function for building and registering a single omap_device record, which in turn builds and registers a platform_device record. See omap_device_build_ss() for more information. Returns ERR_PTR(-EINVAL) if @oh is NULL; otherwise, passes along the return value of omap_device_build_ss(). */
struct omap_device* omap_device_build(const char *pdev_name, int pdev_id, struct omap_hwmod *oh, void *pdata, int pdata_len, struct omap_device_pm_latency *pm_lats, int pm_lats_cnt)
/* Convenience function for building and registering a single omap_device record, which in turn builds and registers a platform_device record. See omap_device_build_ss() for more information. Returns ERR_PTR(-EINVAL) if @oh is NULL; otherwise, passes along the return value of omap_device_build_ss(). */ struct omap_device* omap_device_build(const char *pdev_name, int pdev_id, struct omap_hwmod *oh, void *pdata, int pdata_len, struct omap_device_pm_latency *pm_lats, int pm_lats_cnt)
{ struct omap_hwmod *ohs[] = { oh }; if (!oh) return ERR_PTR(-EINVAL); return omap_device_build_ss(pdev_name, pdev_id, ohs, 1, pdata, pdata_len, pm_lats, pm_lats_cnt); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* The method is slightly modified to shift B unconditionally up to just under the leading bit of b. This saves a lot of multiple precision shifting. */
int mp_montgomery_calc_normalization(mp_int *a, mp_int *b)
/* The method is slightly modified to shift B unconditionally up to just under the leading bit of b. This saves a lot of multiple precision shifting. */ int mp_montgomery_calc_normalization(mp_int *a, mp_int *b)
{ int x, bits, res; bits = mp_count_bits (b) % DIGIT_BIT; if (b->used > 1) { if ((res = mp_2expt (a, (b->used - 1) * DIGIT_BIT + bits - 1)) != MP_OKAY) { return res; } } else { mp_set(a, 1); bits = 1; } for (x = bits - 1; x < (int)DIGIT_BIT; x++) { if ((res = mp_mul_2 (a, a)) != MP_OKAY) { return res; } if (mp_cmp_mag (a, b) != MP_LT) { if ((res = s_mp_sub (a, b, a)) != MP_OKAY) { return res; } } } return MP_OKAY; }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Enables or disables the RTC registers write protection. */
void RTC_EnableWriteProtection(FunctionalState Cmd)
/* Enables or disables the RTC registers write protection. */ void RTC_EnableWriteProtection(FunctionalState Cmd)
{ assert_param(IS_FUNCTIONAL_STATE(Cmd)); if (Cmd != DISABLE) { RTC->WRP = 0xFF; } else { RTC->WRP = 0xCA; RTC->WRP = 0x53; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns a newly built xmlURIPtr or NULL in case of error */
xmlURIPtr xmlParseURI(const char *str)
/* Returns a newly built xmlURIPtr or NULL in case of error */ xmlURIPtr xmlParseURI(const char *str)
{ ret = xmlParse3986URIReference(uri, str); if (ret) { xmlFreeURI(uri); return(NULL); } } return(uri); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Baudrate algorithm come from Linux/drivers/tty/serial/ar933x_uart.c baudrate = (clk / (scale + 1)) * (step * (1 / 2^17)) */
static u32 ar933x_serial_get_baud(u32 clk, u32 scale, u32 step)
/* Baudrate algorithm come from Linux/drivers/tty/serial/ar933x_uart.c baudrate = (clk / (scale + 1)) * (step * (1 / 2^17)) */ static u32 ar933x_serial_get_baud(u32 clk, u32 scale, u32 step)
{ u64 t; u32 div; div = (2 << 16) * (scale + 1); t = clk; t *= step; t += (div / 2); do_div(t, div); return t; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Gets the direction and mode of a pin. */
unsigned long xGPIODirModeGet(unsigned long ulPort, unsigned long ulPin)
/* Gets the direction and mode of a pin. */ unsigned long xGPIODirModeGet(unsigned long ulPort, unsigned long ulPin)
{ unsigned long ulBits; xASSERT(GPIOBaseValid(ulPort)); for(ulBits=0; ulBits<32; ulBits++) { if(ulPin & (1 << ulBits)) { break; } } return GPIODirModeGet(ulPort, ulBits); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Wait for flags to become set on the STATUS register on a CAM interface, checking for errors and timeout. */
static int dvb_ca_en50221_wait_if_status(struct dvb_ca_private *ca, int slot, u8 waitfor, int timeout_hz)
/* Wait for flags to become set on the STATUS register on a CAM interface, checking for errors and timeout. */ static int dvb_ca_en50221_wait_if_status(struct dvb_ca_private *ca, int slot, u8 waitfor, int timeout_hz)
{ unsigned long timeout; unsigned long start; dprintk("%s\n", __func__); start = jiffies; timeout = jiffies + timeout_hz; while (1) { int res = ca->pub->read_cam_control(ca->pub, slot, CTRLIF_STATUS); if (res < 0) return -EIO; if (res & waitfor) { dprintk("%s succeeded timeout:%lu\n", __func__, jiffies - start); return 0; } if (time_after(jiffies, timeout)) { break; } msleep(1); } dprintk("%s failed timeout:%lu\n", __func__, jiffies - start); return -ETIMEDOUT; }
robutest/uclinux
C++
GPL-2.0
60
/* Return the port of the slave that is next in line of @port's slave in the bond, or NULL if it can't be found. */
static struct port* __get_next_port(struct port *port)
/* Return the port of the slave that is next in line of @port's slave in the bond, or NULL if it can't be found. */ static struct port* __get_next_port(struct port *port)
{ struct bonding *bond = __get_bond_by_port(port); struct slave *slave = port->slave; if ((bond == NULL) || (slave->next == bond->first_slave)) { return NULL; } return &(SLAVE_AD_INFO(slave->next).port); }
robutest/uclinux
C++
GPL-2.0
60
/* Write status register 1 byte Returns negative if error occurred. */
static int write_sr(struct m25p *flash, u8 val)
/* Write status register 1 byte Returns negative if error occurred. */ static int write_sr(struct m25p *flash, u8 val)
{ flash->command[0] = OPCODE_WRSR; flash->command[1] = val; return spi_write(flash->spi, flash->command, 2); }
robutest/uclinux
C++
GPL-2.0
60
/* Returns: (transfer full) (type GThemedIcon): a new #GThemedIcon. */
GIcon* g_themed_icon_new_with_default_fallbacks(const char *iconname)
/* Returns: (transfer full) (type GThemedIcon): a new #GThemedIcon. */ GIcon* g_themed_icon_new_with_default_fallbacks(const char *iconname)
{ g_return_val_if_fail (iconname != NULL, NULL); return G_ICON (g_object_new (G_TYPE_THEMED_ICON, "name", iconname, "use-default-fallbacks", TRUE, NULL)); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Saves state on header data for a given stream. */
static spdy_header_info_t* spdy_save_header_block(packet_info *pinfo _U_, guint32 stream_id, guint16 frame_type, guint8 *header, guint length)
/* Saves state on header data for a given stream. */ static spdy_header_info_t* spdy_save_header_block(packet_info *pinfo _U_, guint32 stream_id, guint16 frame_type, guint8 *header, guint length)
{ spdy_header_info_t *header_info; if (header_info_list == NULL) header_info_list = wmem_list_new(wmem_file_scope()); header_info = wmem_new(wmem_file_scope(), spdy_header_info_t); header_info->stream_id = stream_id; header_info->header_block = header; header_info->header_block_len = length; header_info->frame_type = frame_type; wmem_list_append(header_info_list, header_info); return header_info; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* In this case we return -1 to tell the caller that we baled. */
static int shrink_dcache_memory(int nr, gfp_t gfp_mask)
/* In this case we return -1 to tell the caller that we baled. */ static int shrink_dcache_memory(int nr, gfp_t gfp_mask)
{ if (nr) { if (!(gfp_mask & __GFP_FS)) return -1; prune_dcache(nr); } return (dentry_stat.nr_unused / 100) * sysctl_vfs_cache_pressure; }
robutest/uclinux
C++
GPL-2.0
60
/* Setup the input buffer state to scan a string. The next call to zconflex() will scan from a */
YY_BUFFER_STATE zconf_scan_string(yyconst char *yy_str)
/* Setup the input buffer state to scan a string. The next call to zconflex() will scan from a */ YY_BUFFER_STATE zconf_scan_string(yyconst char *yy_str)
{ return zconf_scan_bytes(yystr,(int) strlen(yystr) ); }
pikasTech/PikaPython
C++
MIT License
1,403
/* ASSERT if Ip1 or Ip2 is NULL. ASSERT if PrefixLength exceeds or equals to IP6_PREFIX_MAX. */
BOOLEAN EFIAPI NetIp6IsNetEqual(EFI_IPv6_ADDRESS *Ip1, EFI_IPv6_ADDRESS *Ip2, UINT8 PrefixLength)
/* ASSERT if Ip1 or Ip2 is NULL. ASSERT if PrefixLength exceeds or equals to IP6_PREFIX_MAX. */ BOOLEAN EFIAPI NetIp6IsNetEqual(EFI_IPv6_ADDRESS *Ip1, EFI_IPv6_ADDRESS *Ip2, UINT8 PrefixLength)
{ UINT8 Byte; UINT8 Bit; UINT8 Mask; ASSERT ((Ip1 != NULL) && (Ip2 != NULL) && (PrefixLength < IP6_PREFIX_MAX)); if (PrefixLength == 0) { return TRUE; } Byte = (UINT8)(PrefixLength / 8); Bit = (UINT8)(PrefixLength % 8); if (CompareMem (Ip1, Ip2, Byte) != 0) { return FALSE; } if (Bit > 0) { Mask = (UINT8)(0xFF << (8 - Bit)); ASSERT (Byte < 16); if (Byte >= 16) { return FALSE; } if ((Ip1->Addr[Byte] & Mask) != (Ip2->Addr[Byte] & Mask)) { return FALSE; } } return TRUE; }
tianocore/edk2
C++
Other
4,240
/* Registers an invalidation notifier which will be called when the @closure is invalidated with g_closure_invalidate(). Invalidation notifiers are invoked before finalization notifiers, in an unspecified order. */
void g_closure_add_invalidate_notifier(GClosure *closure, gpointer notify_data, GClosureNotify notify_func)
/* Registers an invalidation notifier which will be called when the @closure is invalidated with g_closure_invalidate(). Invalidation notifiers are invoked before finalization notifiers, in an unspecified order. */ void g_closure_add_invalidate_notifier(GClosure *closure, gpointer notify_data, GClosureNotify notify_func)
{ guint i; g_return_if_fail (closure != NULL); g_return_if_fail (notify_func != NULL); g_return_if_fail (closure->is_invalid == FALSE); g_return_if_fail (closure->n_inotifiers < CLOSURE_MAX_N_INOTIFIERS); closure->notifiers = g_renew (GClosureNotifyData, closure->notifiers, CLOSURE_N_NOTIFIERS (closure) + 1); i = CLOSURE_N_MFUNCS (closure) + closure->n_fnotifiers + closure->n_inotifiers; closure->notifiers[i].data = notify_data; closure->notifiers[i].notify = notify_func; INC (closure, n_inotifiers); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Maximum value of a q31 vector without index. */
void arm_max_no_idx_q31(const q31_t *pSrc, uint32_t blockSize, q31_t *pResult)
/* Maximum value of a q31 vector without index. */ void arm_max_no_idx_q31(const q31_t *pSrc, uint32_t blockSize, q31_t *pResult)
{ q31_t maxVal1, out; uint32_t blkCnt; out = *pSrc++; blkCnt = (blockSize - 1U); while (blkCnt > 0U) { maxVal1 = *pSrc++; if (out < maxVal1) { out = maxVal1; } blkCnt--; } *pResult = out; }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Locking Note: The lport lock is expected to be held before calling this routine. */
void fc_lport_enter_flogi(struct fc_lport *)
/* Locking Note: The lport lock is expected to be held before calling this routine. */ void fc_lport_enter_flogi(struct fc_lport *)
{ struct fc_frame *fp; FC_LPORT_DBG(lport, "Entered FLOGI state from %s state\n", fc_lport_state(lport)); fc_lport_state_enter(lport, LPORT_ST_FLOGI); fp = fc_frame_alloc(lport, sizeof(struct fc_els_flogi)); if (!fp) return fc_lport_error(lport, fp); if (!lport->tt.elsct_send(lport, FC_FID_FLOGI, fp, lport->vport ? ELS_FDISC : ELS_FLOGI, fc_lport_flogi_resp, lport, lport->vport ? 2 * lport->r_a_tov : lport->e_d_tov)) fc_lport_error(lport, NULL); }
robutest/uclinux
C++
GPL-2.0
60
/* This function gets the u-boot flash sector protection status (flash_info_t.protect) in sync with the sector protection status stored in hardware. */
static void flash_sync_real_protect(flash_info_t *info)
/* This function gets the u-boot flash sector protection status (flash_info_t.protect) in sync with the sector protection status stored in hardware. */ static void flash_sync_real_protect(flash_info_t *info)
{ int i; switch (info->flash_id & FLASH_TYPEMASK) { case FLASH_28F256J3A: case FLASH_28F128J3A: case FLASH_28F640J3A: case FLASH_28F320J3A: for (i = 0; i < info->sector_count; ++i) { info->protect[i] = intel_sector_protected(info, i); } break; default: break; } }
EmcraftSystems/u-boot
C++
Other
181
/* ETH MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_ETH_MspDeInit(ETH_HandleTypeDef *heth)
/* ETH MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_ETH_MspDeInit(ETH_HandleTypeDef *heth)
{ if(heth->Instance==ETH) { __HAL_RCC_ETH_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOC, GPIO_PIN_1|GPIO_PIN_4|GPIO_PIN_5); HAL_GPIO_DeInit(GPIOA, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_7); HAL_GPIO_DeInit(GPIOB, GPIO_PIN_11|GPIO_PIN_12|GPIO_PIN_13); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Check if a specific control message was received. */
bool received_control_message(const struct device *dev, const union pd_header header, const enum pd_ctrl_msg_type mt)
/* Check if a specific control message was received. */ bool received_control_message(const struct device *dev, const union pd_header header, const enum pd_ctrl_msg_type mt)
{ struct usbc_port_data *data = dev->data; struct protocol_layer_rx_t *prl_rx = data->prl_rx; if (prl_rx->emsg.len == 0 && header.message_type == mt && header.extended == 0) { return true; } return false; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This function flushes the DTEs for all devices in domain */
static void iommu_flush_domain_devices(struct protection_domain *domain)
/* This function flushes the DTEs for all devices in domain */ static void iommu_flush_domain_devices(struct protection_domain *domain)
{ struct iommu_dev_data *dev_data; unsigned long flags; spin_lock_irqsave(&domain->lock, flags); list_for_each_entry(dev_data, &domain->dev_list, list) iommu_flush_device(dev_data->dev); spin_unlock_irqrestore(&domain->lock, flags); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Description: Start an audit message using the type specified in @type and fill the audit message with some fields common to all NetLabel audit messages. Returns a pointer to the audit buffer on success, NULL on failure. */
struct audit_buffer* netlbl_audit_start_common(int type, struct netlbl_audit *audit_info)
/* Description: Start an audit message using the type specified in @type and fill the audit message with some fields common to all NetLabel audit messages. Returns a pointer to the audit buffer on success, NULL on failure. */ struct audit_buffer* netlbl_audit_start_common(int type, struct netlbl_audit *audit_info)
{ struct audit_buffer *audit_buf; char *secctx; u32 secctx_len; if (audit_enabled == 0) return NULL; audit_buf = audit_log_start(current->audit_context, GFP_ATOMIC, type); if (audit_buf == NULL) return NULL; audit_log_format(audit_buf, "netlabel: auid=%u ses=%u", audit_info->loginuid, audit_info->sessionid); if (audit_info->secid != 0 && security_secid_to_secctx(audit_info->secid, &secctx, &secctx_len) == 0) { audit_log_format(audit_buf, " subj=%s", secctx); security_release_secctx(secctx, secctx_len); } return audit_buf; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* pvalloc(size_t n); Equivalent to valloc(minimum-page-that-holds(n)), that is, round up n to nearest pagesize. */
void * dlpvalloc(size_t)
/* pvalloc(size_t n); Equivalent to valloc(minimum-page-that-holds(n)), that is, round up n to nearest pagesize. */ void * dlpvalloc(size_t)
{ size_t pagesz; init_mparams(); pagesz = mparams.page_size; return dlmemalign(pagesz, (bytes + pagesz - SIZE_T_ONE) & ~(pagesz - SIZE_T_ONE)); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* This function configures the source of the time base. The time source is configured to have 1ms time base with a dedicated Tick interrupt priority. */
__weak HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
/* This function configures the source of the time base. The time source is configured to have 1ms time base with a dedicated Tick interrupt priority. */ __weak HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
{ if((uint32_t)uwTickFreq == 0UL) { return HAL_ERROR; } if (HAL_SYSTICK_Config(SystemCoreClock / (1000UL / (uint32_t)uwTickFreq)) > 0U) { return HAL_ERROR; } if (TickPriority < (1UL << __NVIC_PRIO_BITS)) { HAL_NVIC_SetPriority(SysTick_IRQn, TickPriority, 0U); uwTickPrio = TickPriority; } else { return HAL_ERROR; } return HAL_OK; }
ua1arn/hftrx
C++
null
69
/* When this returns zero, a new bus number was allocated and stored in adap->nr, and the specified adapter became available for clients. Otherwise, a negative errno value is returned. */
int i2c_add_adapter(struct i2c_adapter *adapter)
/* When this returns zero, a new bus number was allocated and stored in adap->nr, and the specified adapter became available for clients. Otherwise, a negative errno value is returned. */ int i2c_add_adapter(struct i2c_adapter *adapter)
{ int id, res = 0; retry: if (idr_pre_get(&i2c_adapter_idr, GFP_KERNEL) == 0) return -ENOMEM; mutex_lock(&core_lock); res = idr_get_new_above(&i2c_adapter_idr, adapter, __i2c_first_dynamic_bus_num, &id); mutex_unlock(&core_lock); if (res < 0) { if (res == -EAGAIN) goto retry; return res; } adapter->nr = id; return i2c_register_adapter(adapter); }
robutest/uclinux
C++
GPL-2.0
60
/* Reads an unsigned 8 bit values over I2C. */
err_t lis3dhRead8(uint8_t reg, uint8_t *value)
/* Reads an unsigned 8 bit values over I2C. */ err_t lis3dhRead8(uint8_t reg, uint8_t *value)
{ I2CWriteLength = 2; I2CReadLength = 0; I2CMasterBuffer[0] = LIS3DH_ADDRESS; I2CMasterBuffer[1] = reg; i2cEngine(); I2CWriteLength = 0; I2CReadLength = 1; I2CMasterBuffer[0] = LIS3DH_ADDRESS | LIS3DH_READBIT; ASSERT_I2C_STATUS(i2cEngine()); *value = I2CSlaveBuffer[0]; return ERROR_NONE; }
microbuilder/LPC11U_LPC13U_CodeBase
C++
Other
54
/* Software reset. Restore the default values in user registers. */
int32_t lps22hb_reset_set(stmdev_ctx_t *ctx, uint8_t val)
/* Software reset. Restore the default values in user registers. */ int32_t lps22hb_reset_set(stmdev_ctx_t *ctx, uint8_t val)
{ lps22hb_ctrl_reg2_t ctrl_reg2; int32_t ret; ret = lps22hb_read_reg(ctx, LPS22HB_CTRL_REG2, (uint8_t*)&ctrl_reg2, 1); if(ret == 0){ ctrl_reg2.swreset = val; ret = lps22hb_write_reg(ctx, LPS22HB_CTRL_REG2, (uint8_t*)&ctrl_reg2, 1); } return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* Must be called with the hb lock held. */
static struct futex_q* futex_top_waiter(struct futex_hash_bucket *hb, union futex_key *key)
/* Must be called with the hb lock held. */ static struct futex_q* futex_top_waiter(struct futex_hash_bucket *hb, union futex_key *key)
{ struct futex_q *this; plist_for_each_entry(this, &hb->chain, list) { if (match_futex(&this->key, key)) return this; } return NULL; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function looks up the iocb_lookup table to get the command iocb corresponding to the given iotag. This function is called with the hbalock held. This function returns the command iocb object if it finds the command iocb else returns NULL. */
static struct lpfc_iocbq* lpfc_sli_iocbq_lookup_by_tag(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, uint16_t iotag)
/* This function looks up the iocb_lookup table to get the command iocb corresponding to the given iotag. This function is called with the hbalock held. This function returns the command iocb object if it finds the command iocb else returns NULL. */ static struct lpfc_iocbq* lpfc_sli_iocbq_lookup_by_tag(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, uint16_t iotag)
{ struct lpfc_iocbq *cmd_iocb; if (iotag != 0 && iotag <= phba->sli.last_iotag) { cmd_iocb = phba->sli.iocbq_lookup[iotag]; list_del_init(&cmd_iocb->list); pring->txcmplq_cnt--; return cmd_iocb; } lpfc_printf_log(phba, KERN_ERR, LOG_SLI, "0372 iotag x%x is out off range: max iotag (x%x)\n", iotag, phba->sli.last_iotag); return NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* Returns: the (possibly changed) start of the #GList */
GList* g_list_remove_all(GList *list, gconstpointer data)
/* Returns: the (possibly changed) start of the #GList */ GList* g_list_remove_all(GList *list, gconstpointer data)
{ GList *tmp = list; while (tmp) { if (tmp->data != data) tmp = tmp->next; else { GList *next = tmp->next; if (tmp->prev) tmp->prev->next = next; else list = next; if (next) next->prev = tmp->prev; _g_list_free1 (tmp); tmp = next; } } return list; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Return value: 0 on success / other on failure */
static int ibmvfc_issue_fc_host_lip(struct Scsi_Host *shost)
/* Return value: 0 on success / other on failure */ static int ibmvfc_issue_fc_host_lip(struct Scsi_Host *shost)
{ struct ibmvfc_host *vhost = shost_priv(shost); dev_err(vhost->dev, "Initiating host LIP. Resetting connection\n"); ibmvfc_reset_host(vhost); return ibmvfc_wait_while_resetting(vhost); }
robutest/uclinux
C++
GPL-2.0
60
/* Return code 0 - driver suspended the device Error otherwise */
static int lpfc_pci_suspend_one_s4(struct pci_dev *pdev, pm_message_t msg)
/* Return code 0 - driver suspended the device Error otherwise */ static int lpfc_pci_suspend_one_s4(struct pci_dev *pdev, pm_message_t msg)
{ struct Scsi_Host *shost = pci_get_drvdata(pdev); struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; lpfc_printf_log(phba, KERN_INFO, LOG_INIT, "0298 PCI device Power Management suspend.\n"); lpfc_offline_prep(phba); lpfc_offline(phba); kthread_stop(phba->worker_thread); lpfc_sli4_disable_intr(phba); pci_save_state(pdev); pci_set_power_state(pdev, PCI_D3hot); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* crypto_rsa_get_modulus_len - Get the modulus length of the RSA key @key: RSA key Returns: Modulus length of the key */
size_t crypto_rsa_get_modulus_len(struct crypto_rsa_key *key)
/* crypto_rsa_get_modulus_len - Get the modulus length of the RSA key @key: RSA key Returns: Modulus length of the key */ size_t crypto_rsa_get_modulus_len(struct crypto_rsa_key *key)
{ return bignum_get_unsigned_bin_len(key->n); }
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* Resize a virtual console as seen from the console end of things. We use the common vc_do_resize methods to update the structures. The caller must hold the console sem to protect console internals and vc->vc_tty */
int vc_resize(struct vc_data *vc, unsigned int cols, unsigned int rows)
/* Resize a virtual console as seen from the console end of things. We use the common vc_do_resize methods to update the structures. The caller must hold the console sem to protect console internals and vc->vc_tty */ int vc_resize(struct vc_data *vc, unsigned int cols, unsigned int rows)
{ return vc_do_resize(vc->vc_tty, vc, cols, rows); }
robutest/uclinux
C++
GPL-2.0
60
/* The example of the function of read and write. */
void HX8347Example(void)
/* The example of the function of read and write. */ void HX8347Example(void)
{ xSysCtlClockSet(72000000, xSYSCTL_OSC_MAIN | SYSCTL_XTAL_25MHZ); HX8347Init(18000000); HX8347LCDClear(Blue); xSysCtlDelay(2000000); HX8347LCDClear(White); HX8347SetBackColor(Blue); HX8347SetTextColor(White); HX8347DisplayString(0, 0, " STM32F1xx Board "); HX8347SetBackColor(Blue); HX8347SetTextColor(Red); HX8347DisplayString(1, 0, " HX8347-G EXAMPLE "); HX8347SetBackColor(White); HX8347SetTextColor(Red); HX8347DisplayN(8, 15, 2012); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* When we die, we re-parent all our children. Try to give them to another thread in our thread group, and if no such member exists, give it to the child reaper process (ie "init") in our pid space. */
static struct task_struct* find_new_reaper(struct task_struct *father)
/* When we die, we re-parent all our children. Try to give them to another thread in our thread group, and if no such member exists, give it to the child reaper process (ie "init") in our pid space. */ static struct task_struct* find_new_reaper(struct task_struct *father)
{ struct pid_namespace *pid_ns = task_active_pid_ns(father); struct task_struct *thread; thread = father; while_each_thread(father, thread) { if (thread->flags & PF_EXITING) continue; if (unlikely(pid_ns->child_reaper == father)) pid_ns->child_reaper = thread; return thread; } if (unlikely(pid_ns->child_reaper == father)) { write_unlock_irq(&tasklist_lock); if (unlikely(pid_ns == &init_pid_ns)) panic("Attempted to kill init!"); zap_pid_ns_processes(pid_ns); write_lock_irq(&tasklist_lock); pid_ns->child_reaper = init_pid_ns.child_reaper; } return pid_ns->child_reaper; }
EmcraftSystems/linux-emcraft
C++
Other
266