提交 4a3bc6b1 编写于 作者: F fengsheng 提交者: Xie XiuQi

sfc: fix bug sfc can not rmmod.

driver inclusion
category: feature
bugzilla: NA
CVE: NA

fix bug:fix bug can not rmmod.
Signed-off-by: Nfengsheng <fengsheng5@huawei.com>
Reviewed-by: Nlinsiwei <linsiwei@huawei.com>
Reviewed-by: NYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 9f149ec2
...@@ -27,9 +27,8 @@ ...@@ -27,9 +27,8 @@
#include <linux/acpi.h> #include <linux/acpi.h>
#include "hrdCommon.h" #include "hrdCommon.h"
#include "hrd_sflash_driver.h" #include "hrd_sflash_driver.h"
#include "hrd_sflash_hal.h"
#define SFC_DRIVER_VERSION "1.7.8.0" #define SFC_DRIVER_VERSION "1.7.9.0"
static const char *sflashMtdList[] = { "sflash", NULL }; static const char *sflashMtdList[] = { "sflash", NULL };
...@@ -147,6 +146,10 @@ static unsigned int flash_map_init(struct platform_device *pdev) ...@@ -147,6 +146,10 @@ static unsigned int flash_map_init(struct platform_device *pdev)
sfc_regres = platform_get_resource(pdev, IORESOURCE_MEM, 0); sfc_regres = platform_get_resource(pdev, IORESOURCE_MEM, 0);
flash_iores = platform_get_resource(pdev, IORESOURCE_MEM, 1); flash_iores = platform_get_resource(pdev, IORESOURCE_MEM, 1);
if (!sfc_regres || !flash_iores) {
return -EFAULT;
}
if (sfc_regres->end <= sfc_regres->start) { if (sfc_regres->end <= sfc_regres->start) {
pr_err("ERROR: sfc register error\n"); pr_err("ERROR: sfc register error\n");
return -EFAULT; return -EFAULT;
...@@ -193,7 +196,6 @@ static void __exit flash_map_exit(struct platform_device *pdev) ...@@ -193,7 +196,6 @@ static void __exit flash_map_exit(struct platform_device *pdev)
for (i = 0; i < host->mapsNum; i++) { for (i = 0; i < host->mapsNum; i++) {
if (host->maps[i].mtdInfo) { if (host->maps[i].mtdInfo) {
(void)mtd_device_unregister(host->maps[i].mtdInfo); (void)mtd_device_unregister(host->maps[i].mtdInfo);
map_destroy(host->maps[i].mtdInfo);
} }
if (host->maps[i].mapInfo.virt) { if (host->maps[i].mapInfo.virt) {
...@@ -201,7 +203,7 @@ static void __exit flash_map_exit(struct platform_device *pdev) ...@@ -201,7 +203,7 @@ static void __exit flash_map_exit(struct platform_device *pdev)
host->maps[i].mapInfo.virt = 0; host->maps[i].mapInfo.virt = 0;
} }
if (host->maps[i].mtdInfo) { if (host->maps[i].mtdInfo) {
sflash_destroy(host->maps[i].mtdInfo); sflash_destroy(host->maps[i].mtdInfo);
} }
} }
......
...@@ -164,7 +164,6 @@ struct mtd_info *sflash_probe(struct map_info *map, struct resource *sfc_regres) ...@@ -164,7 +164,6 @@ struct mtd_info *sflash_probe(struct map_info *map, struct resource *sfc_regres)
((sflash->sectorNumber * sflash->sectorSize) / 1024), ((sflash->sectorNumber * sflash->sectorSize) / 1024),
sflash->sectorNumber, (sflash->sectorSize / 1024)); sflash->sectorNumber, (sflash->sectorSize / 1024));
__module_get(THIS_MODULE);
return mtd; return mtd;
exit0: exit0:
......
...@@ -999,7 +999,7 @@ static s32 SFC_RegWordAlignRead(struct SFC_SFLASH_INFO *sflash, ...@@ -999,7 +999,7 @@ static s32 SFC_RegWordAlignRead(struct SFC_SFLASH_INFO *sflash,
} }
for (i = 0; i < ulDataCnt; i++) { for (i = 0; i < ulDataCnt; i++) {
pulData[i] = SFC_RegisterRead(sflash->sfc_reg_base + DATABUFFER1 + 4*i); pulData[i] = SFC_RegisterRead(sflash->sfc_reg_base + DATABUFFER1 + (u32)(4*i));
} }
return ulRet; return ulRet;
...@@ -1069,7 +1069,7 @@ static s32 SFC_RegWordAlignWrite(struct SFC_SFLASH_INFO *sflash, ...@@ -1069,7 +1069,7 @@ static s32 SFC_RegWordAlignWrite(struct SFC_SFLASH_INFO *sflash,
ulDataCnt = ulWriteLen>>2; ulDataCnt = ulWriteLen>>2;
for (i = 0; i < ulDataCnt; i++) { for (i = 0; i < ulDataCnt; i++) {
SFC_RegisterWrite(sflash->sfc_reg_base + DATABUFFER1+4*i, ulData[i]); SFC_RegisterWrite(sflash->sfc_reg_base + DATABUFFER1 + (u32)(4*i), ulData[i]);
} }
SFC_RegisterWrite(sflash->sfc_reg_base + CMD_ADDR, ulOffsetAddr); SFC_RegisterWrite(sflash->sfc_reg_base + CMD_ADDR, ulOffsetAddr);
......
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2019 Hisilicon Limited, All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http:
*/
#ifndef __HI_LBC_H__
#define __HI_LBC_H__
/**
* lbc_read8 - read a register byte data through lbc
* @index: cs index
* @offset: register offset
* @value: register byte data
* return 0 - success, negative - fail
*/
int lbc_read8(unsigned int index, unsigned int offset, unsigned char *value);
/**
* lbc_write8 - write a register byte data through lbc
* @index: cs index
* @offset: register offset
* @data: register byte data
* return 0 - success, negative - fail
*/
int lbc_write8(unsigned int index, unsigned int offset, unsigned char data);
/**
* lbc_read8_nolock - read a register byte data through lbc(no lock)
* @index: cs index
* @offset: register offset
* @value: register byte data
* return 0 - success, negative - fail
*/
int lbc_read8_nolock(unsigned int index, unsigned int offset, unsigned char *value);
/**
* lbc_write8_nolock - write a register byte data through lbc(no lock)
* @index: cs index
* @offset: register offset
* @value: register byte data
* return 0 - success, negative - fail
*/
int lbc_write8_nolock(unsigned int index, unsigned int offset, unsigned char data);
#endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册