mirror of https://gitee.com/openkylin/linux.git
mtd: denali: remove unnecessary variable initializations
All of these variables are initialized to zero and then set to a different value below. Zero-initializing is redundant. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
This commit is contained in:
parent
43914a2dcc
commit
5637b69d1c
|
@ -146,7 +146,7 @@ static void write_byte_to_buf(struct denali_nand_info *denali, uint8_t byte)
|
||||||
/* reads the status of the device */
|
/* reads the status of the device */
|
||||||
static void read_status(struct denali_nand_info *denali)
|
static void read_status(struct denali_nand_info *denali)
|
||||||
{
|
{
|
||||||
uint32_t cmd = 0x0;
|
uint32_t cmd;
|
||||||
|
|
||||||
/* initialize the data buffer to store status */
|
/* initialize the data buffer to store status */
|
||||||
reset_buf(denali);
|
reset_buf(denali);
|
||||||
|
@ -161,7 +161,7 @@ static void read_status(struct denali_nand_info *denali)
|
||||||
/* resets a specific device connected to the core */
|
/* resets a specific device connected to the core */
|
||||||
static void reset_bank(struct denali_nand_info *denali)
|
static void reset_bank(struct denali_nand_info *denali)
|
||||||
{
|
{
|
||||||
uint32_t irq_status = 0;
|
uint32_t irq_status;
|
||||||
uint32_t irq_mask = INTR_STATUS__RST_COMP |
|
uint32_t irq_mask = INTR_STATUS__RST_COMP |
|
||||||
INTR_STATUS__TIME_OUT;
|
INTR_STATUS__TIME_OUT;
|
||||||
|
|
||||||
|
@ -581,7 +581,7 @@ static inline bool is_flash_bank_valid(int flash_bank)
|
||||||
|
|
||||||
static void denali_irq_init(struct denali_nand_info *denali)
|
static void denali_irq_init(struct denali_nand_info *denali)
|
||||||
{
|
{
|
||||||
uint32_t int_mask = 0;
|
uint32_t int_mask;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Disable global interrupts */
|
/* Disable global interrupts */
|
||||||
|
@ -624,7 +624,7 @@ static inline uint32_t denali_irq_detected(struct denali_nand_info *denali)
|
||||||
static inline void clear_interrupt(struct denali_nand_info *denali,
|
static inline void clear_interrupt(struct denali_nand_info *denali,
|
||||||
uint32_t irq_mask)
|
uint32_t irq_mask)
|
||||||
{
|
{
|
||||||
uint32_t intr_status_reg = 0;
|
uint32_t intr_status_reg;
|
||||||
|
|
||||||
intr_status_reg = INTR_STATUS(denali->flash_bank);
|
intr_status_reg = INTR_STATUS(denali->flash_bank);
|
||||||
|
|
||||||
|
@ -633,7 +633,8 @@ static inline void clear_interrupt(struct denali_nand_info *denali,
|
||||||
|
|
||||||
static void clear_interrupts(struct denali_nand_info *denali)
|
static void clear_interrupts(struct denali_nand_info *denali)
|
||||||
{
|
{
|
||||||
uint32_t status = 0x0;
|
uint32_t status;
|
||||||
|
|
||||||
spin_lock_irq(&denali->irq_lock);
|
spin_lock_irq(&denali->irq_lock);
|
||||||
|
|
||||||
status = read_interrupt_status(denali);
|
status = read_interrupt_status(denali);
|
||||||
|
@ -645,7 +646,7 @@ static void clear_interrupts(struct denali_nand_info *denali)
|
||||||
|
|
||||||
static uint32_t read_interrupt_status(struct denali_nand_info *denali)
|
static uint32_t read_interrupt_status(struct denali_nand_info *denali)
|
||||||
{
|
{
|
||||||
uint32_t intr_status_reg = 0;
|
uint32_t intr_status_reg;
|
||||||
|
|
||||||
intr_status_reg = INTR_STATUS(denali->flash_bank);
|
intr_status_reg = INTR_STATUS(denali->flash_bank);
|
||||||
|
|
||||||
|
@ -659,7 +660,7 @@ static uint32_t read_interrupt_status(struct denali_nand_info *denali)
|
||||||
static irqreturn_t denali_isr(int irq, void *dev_id)
|
static irqreturn_t denali_isr(int irq, void *dev_id)
|
||||||
{
|
{
|
||||||
struct denali_nand_info *denali = dev_id;
|
struct denali_nand_info *denali = dev_id;
|
||||||
uint32_t irq_status = 0x0;
|
uint32_t irq_status;
|
||||||
irqreturn_t result = IRQ_NONE;
|
irqreturn_t result = IRQ_NONE;
|
||||||
|
|
||||||
spin_lock(&denali->irq_lock);
|
spin_lock(&denali->irq_lock);
|
||||||
|
@ -693,8 +694,8 @@ static irqreturn_t denali_isr(int irq, void *dev_id)
|
||||||
|
|
||||||
static uint32_t wait_for_irq(struct denali_nand_info *denali, uint32_t irq_mask)
|
static uint32_t wait_for_irq(struct denali_nand_info *denali, uint32_t irq_mask)
|
||||||
{
|
{
|
||||||
unsigned long comp_res = 0;
|
unsigned long comp_res;
|
||||||
uint32_t intr_status = 0;
|
uint32_t intr_status;
|
||||||
bool retry = false;
|
bool retry = false;
|
||||||
unsigned long timeout = msecs_to_jiffies(1000);
|
unsigned long timeout = msecs_to_jiffies(1000);
|
||||||
|
|
||||||
|
@ -736,7 +737,7 @@ static uint32_t wait_for_irq(struct denali_nand_info *denali, uint32_t irq_mask)
|
||||||
static void setup_ecc_for_xfer(struct denali_nand_info *denali, bool ecc_en,
|
static void setup_ecc_for_xfer(struct denali_nand_info *denali, bool ecc_en,
|
||||||
bool transfer_spare)
|
bool transfer_spare)
|
||||||
{
|
{
|
||||||
int ecc_en_flag = 0, transfer_spare_flag = 0;
|
int ecc_en_flag, transfer_spare_flag;
|
||||||
|
|
||||||
/* set ECC, transfer spare bits if needed */
|
/* set ECC, transfer spare bits if needed */
|
||||||
ecc_en_flag = ecc_en ? ECC_ENABLE__FLAG : 0;
|
ecc_en_flag = ecc_en ? ECC_ENABLE__FLAG : 0;
|
||||||
|
@ -759,8 +760,8 @@ static int denali_send_pipeline_cmd(struct denali_nand_info *denali,
|
||||||
int op)
|
int op)
|
||||||
{
|
{
|
||||||
int status = PASS;
|
int status = PASS;
|
||||||
uint32_t addr = 0x0, cmd = 0x0, page_count = 1, irq_status = 0,
|
uint32_t page_count = 1;
|
||||||
irq_mask = 0;
|
uint32_t addr, cmd, irq_status, irq_mask;
|
||||||
|
|
||||||
if (op == DENALI_READ)
|
if (op == DENALI_READ)
|
||||||
irq_mask = INTR_STATUS__LOAD_COMP;
|
irq_mask = INTR_STATUS__LOAD_COMP;
|
||||||
|
@ -829,7 +830,7 @@ static int write_data_to_flash_mem(struct denali_nand_info *denali,
|
||||||
const uint8_t *buf,
|
const uint8_t *buf,
|
||||||
int len)
|
int len)
|
||||||
{
|
{
|
||||||
uint32_t i = 0, *buf32;
|
uint32_t i, *buf32;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* verify that the len is a multiple of 4.
|
* verify that the len is a multiple of 4.
|
||||||
|
@ -849,7 +850,7 @@ static int read_data_from_flash_mem(struct denali_nand_info *denali,
|
||||||
uint8_t *buf,
|
uint8_t *buf,
|
||||||
int len)
|
int len)
|
||||||
{
|
{
|
||||||
uint32_t i = 0, *buf32;
|
uint32_t i, *buf32;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* we assume that len will be a multiple of 4, if not it would be nice
|
* we assume that len will be a multiple of 4, if not it would be nice
|
||||||
|
@ -870,7 +871,7 @@ static int read_data_from_flash_mem(struct denali_nand_info *denali,
|
||||||
static int write_oob_data(struct mtd_info *mtd, uint8_t *buf, int page)
|
static int write_oob_data(struct mtd_info *mtd, uint8_t *buf, int page)
|
||||||
{
|
{
|
||||||
struct denali_nand_info *denali = mtd_to_denali(mtd);
|
struct denali_nand_info *denali = mtd_to_denali(mtd);
|
||||||
uint32_t irq_status = 0;
|
uint32_t irq_status;
|
||||||
uint32_t irq_mask = INTR_STATUS__PROGRAM_COMP |
|
uint32_t irq_mask = INTR_STATUS__PROGRAM_COMP |
|
||||||
INTR_STATUS__PROGRAM_FAIL;
|
INTR_STATUS__PROGRAM_FAIL;
|
||||||
int status = 0;
|
int status = 0;
|
||||||
|
@ -899,8 +900,8 @@ static int write_oob_data(struct mtd_info *mtd, uint8_t *buf, int page)
|
||||||
static void read_oob_data(struct mtd_info *mtd, uint8_t *buf, int page)
|
static void read_oob_data(struct mtd_info *mtd, uint8_t *buf, int page)
|
||||||
{
|
{
|
||||||
struct denali_nand_info *denali = mtd_to_denali(mtd);
|
struct denali_nand_info *denali = mtd_to_denali(mtd);
|
||||||
uint32_t irq_mask = INTR_STATUS__LOAD_COMP,
|
uint32_t irq_mask = INTR_STATUS__LOAD_COMP;
|
||||||
irq_status = 0, addr = 0x0, cmd = 0x0;
|
uint32_t irq_status, addr, cmd;
|
||||||
|
|
||||||
denali->page = page;
|
denali->page = page;
|
||||||
|
|
||||||
|
@ -938,7 +939,7 @@ static void read_oob_data(struct mtd_info *mtd, uint8_t *buf, int page)
|
||||||
*/
|
*/
|
||||||
static bool is_erased(uint8_t *buf, int len)
|
static bool is_erased(uint8_t *buf, int len)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i;
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
if (buf[i] != 0xFF)
|
if (buf[i] != 0xFF)
|
||||||
return false;
|
return false;
|
||||||
|
@ -961,9 +962,8 @@ static bool handle_ecc(struct denali_nand_info *denali, uint8_t *buf,
|
||||||
|
|
||||||
if (irq_status & INTR_STATUS__ECC_ERR) {
|
if (irq_status & INTR_STATUS__ECC_ERR) {
|
||||||
/* read the ECC errors. we'll ignore them for now */
|
/* read the ECC errors. we'll ignore them for now */
|
||||||
uint32_t err_address = 0, err_correction_info = 0;
|
uint32_t err_address, err_correction_info, err_byte,
|
||||||
uint32_t err_byte = 0, err_sector = 0, err_device = 0;
|
err_sector, err_device, err_correction_value;
|
||||||
uint32_t err_correction_value = 0;
|
|
||||||
denali_set_intr_modes(denali, false);
|
denali_set_intr_modes(denali, false);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
@ -1026,19 +1026,14 @@ static bool handle_ecc(struct denali_nand_info *denali, uint8_t *buf,
|
||||||
/* programs the controller to either enable/disable DMA transfers */
|
/* programs the controller to either enable/disable DMA transfers */
|
||||||
static void denali_enable_dma(struct denali_nand_info *denali, bool en)
|
static void denali_enable_dma(struct denali_nand_info *denali, bool en)
|
||||||
{
|
{
|
||||||
uint32_t reg_val = 0x0;
|
iowrite32(en ? DMA_ENABLE__FLAG : 0, denali->flash_reg + DMA_ENABLE);
|
||||||
|
|
||||||
if (en)
|
|
||||||
reg_val = DMA_ENABLE__FLAG;
|
|
||||||
|
|
||||||
iowrite32(reg_val, denali->flash_reg + DMA_ENABLE);
|
|
||||||
ioread32(denali->flash_reg + DMA_ENABLE);
|
ioread32(denali->flash_reg + DMA_ENABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* setups the HW to perform the data DMA */
|
/* setups the HW to perform the data DMA */
|
||||||
static void denali_setup_dma(struct denali_nand_info *denali, int op)
|
static void denali_setup_dma(struct denali_nand_info *denali, int op)
|
||||||
{
|
{
|
||||||
uint32_t mode = 0x0;
|
uint32_t mode;
|
||||||
const int page_count = 1;
|
const int page_count = 1;
|
||||||
dma_addr_t addr = denali->buf.dma_buf;
|
dma_addr_t addr = denali->buf.dma_buf;
|
||||||
|
|
||||||
|
@ -1071,7 +1066,7 @@ static int write_page(struct mtd_info *mtd, struct nand_chip *chip,
|
||||||
dma_addr_t addr = denali->buf.dma_buf;
|
dma_addr_t addr = denali->buf.dma_buf;
|
||||||
size_t size = denali->mtd.writesize + denali->mtd.oobsize;
|
size_t size = denali->mtd.writesize + denali->mtd.oobsize;
|
||||||
|
|
||||||
uint32_t irq_status = 0;
|
uint32_t irq_status;
|
||||||
uint32_t irq_mask = INTR_STATUS__DMA_CMD_COMP |
|
uint32_t irq_mask = INTR_STATUS__DMA_CMD_COMP |
|
||||||
INTR_STATUS__PROGRAM_FAIL;
|
INTR_STATUS__PROGRAM_FAIL;
|
||||||
|
|
||||||
|
@ -1170,7 +1165,7 @@ static int denali_read_page(struct mtd_info *mtd, struct nand_chip *chip,
|
||||||
dma_addr_t addr = denali->buf.dma_buf;
|
dma_addr_t addr = denali->buf.dma_buf;
|
||||||
size_t size = denali->mtd.writesize + denali->mtd.oobsize;
|
size_t size = denali->mtd.writesize + denali->mtd.oobsize;
|
||||||
|
|
||||||
uint32_t irq_status = 0;
|
uint32_t irq_status;
|
||||||
uint32_t irq_mask = INTR_STATUS__ECC_TRANSACTION_DONE |
|
uint32_t irq_mask = INTR_STATUS__ECC_TRANSACTION_DONE |
|
||||||
INTR_STATUS__ECC_ERR;
|
INTR_STATUS__ECC_ERR;
|
||||||
bool check_erased_page = false;
|
bool check_erased_page = false;
|
||||||
|
@ -1222,7 +1217,7 @@ static int denali_read_page_raw(struct mtd_info *mtd, struct nand_chip *chip,
|
||||||
dma_addr_t addr = denali->buf.dma_buf;
|
dma_addr_t addr = denali->buf.dma_buf;
|
||||||
size_t size = denali->mtd.writesize + denali->mtd.oobsize;
|
size_t size = denali->mtd.writesize + denali->mtd.oobsize;
|
||||||
|
|
||||||
uint32_t irq_status = 0;
|
uint32_t irq_status;
|
||||||
uint32_t irq_mask = INTR_STATUS__DMA_CMD_COMP;
|
uint32_t irq_mask = INTR_STATUS__DMA_CMD_COMP;
|
||||||
|
|
||||||
if (page != denali->page) {
|
if (page != denali->page) {
|
||||||
|
@ -1286,7 +1281,7 @@ static int denali_erase(struct mtd_info *mtd, int page)
|
||||||
{
|
{
|
||||||
struct denali_nand_info *denali = mtd_to_denali(mtd);
|
struct denali_nand_info *denali = mtd_to_denali(mtd);
|
||||||
|
|
||||||
uint32_t cmd = 0x0, irq_status = 0;
|
uint32_t cmd, irq_status;
|
||||||
|
|
||||||
clear_interrupts(denali);
|
clear_interrupts(denali);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue