treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / drivers / net / ethernet / altera / altera_utils.c
blobe6a7fc9d8fb1c8dbcf511aadb1d54d9186a6e8b6
1 // SPDX-License-Identifier: GPL-2.0-only
2 /* Altera TSE SGDMA and MSGDMA Linux driver
3 * Copyright (C) 2014 Altera Corporation. All rights reserved
4 */
6 #include "altera_tse.h"
7 #include "altera_utils.h"
9 void tse_set_bit(void __iomem *ioaddr, size_t offs, u32 bit_mask)
11 u32 value = csrrd32(ioaddr, offs);
12 value |= bit_mask;
13 csrwr32(value, ioaddr, offs);
16 void tse_clear_bit(void __iomem *ioaddr, size_t offs, u32 bit_mask)
18 u32 value = csrrd32(ioaddr, offs);
19 value &= ~bit_mask;
20 csrwr32(value, ioaddr, offs);
23 int tse_bit_is_set(void __iomem *ioaddr, size_t offs, u32 bit_mask)
25 u32 value = csrrd32(ioaddr, offs);
26 return (value & bit_mask) ? 1 : 0;
29 int tse_bit_is_clear(void __iomem *ioaddr, size_t offs, u32 bit_mask)
31 u32 value = csrrd32(ioaddr, offs);
32 return (value & bit_mask) ? 0 : 1;