/* em28xx_write_reg_bits() sets only some bits (specified by bitmask) of a register, by first reading the actual value  */
int em28xx_write_reg_bits(struct em28xx *dev, u16 reg, u8 val, u8 bitmask)
/* em28xx_write_reg_bits() sets only some bits (specified by bitmask) of a register, by first reading the actual value  */
int em28xx_write_reg_bits(struct em28xx *dev, u16 reg, u8 val, u8 bitmask)
{
	int oldval;
	u8 newval;
	if (reg == dev->reg_gpo_num)
		oldval = dev->reg_gpo;
	else if (reg == dev->reg_gpio_num)
		oldval = dev->reg_gpio;
	else
		oldval = em28xx_read_reg(dev, reg);
	if (oldval < 0)
		return oldval;
	newval = (((u8) oldval) & ~bitmask) | (val & bitmask);
	return em28xx_write_regs(dev, reg, &newval, 1);
}