Skip to content

Commit c314dfd

Browse files
David WoodhouseDavid Woodhouse
authored andcommitted
[MTD] [NOR] Rename and export new cfi_qry_*() functions
They need to be exported, so let's give them less generic-sounding names while we're at it. Original export patch, along with the suggestion about the nomenclature, from Stephen Rothwell. Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
1 parent 8c64038 commit c314dfd

File tree

3 files changed

+31
-27
lines changed

3 files changed

+31
-27
lines changed

drivers/mtd/chips/cfi_probe.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ do { \
4444

4545
#define xip_enable(base, map, cfi) \
4646
do { \
47-
qry_mode_off(base, map, cfi); \
47+
cfi_qry_mode_off(base, map, cfi); \
4848
xip_allowed(base, map); \
4949
} while (0)
5050

5151
#define xip_disable_qry(base, map, cfi) \
5252
do { \
5353
xip_disable(); \
54-
qry_mode_on(base, map, cfi); \
54+
cfi_qry_mode_on(base, map, cfi); \
5555
} while (0)
5656

5757
#else
@@ -87,7 +87,7 @@ static int __xipram cfi_probe_chip(struct map_info *map, __u32 base,
8787
}
8888

8989
xip_disable();
90-
if (!qry_mode_on(base, map, cfi)) {
90+
if (!cfi_qry_mode_on(base, map, cfi)) {
9191
xip_enable(base, map, cfi);
9292
return 0;
9393
}
@@ -108,13 +108,13 @@ static int __xipram cfi_probe_chip(struct map_info *map, __u32 base,
108108
start = i << cfi->chipshift;
109109
/* This chip should be in read mode if it's one
110110
we've already touched. */
111-
if (qry_present(map, start, cfi)) {
111+
if (cfi_qry_present(map, start, cfi)) {
112112
/* Eep. This chip also had the QRY marker.
113113
* Is it an alias for the new one? */
114-
qry_mode_off(start, map, cfi);
114+
cfi_qry_mode_off(start, map, cfi);
115115

116116
/* If the QRY marker goes away, it's an alias */
117-
if (!qry_present(map, start, cfi)) {
117+
if (!cfi_qry_present(map, start, cfi)) {
118118
xip_allowed(base, map);
119119
printk(KERN_DEBUG "%s: Found an alias at 0x%x for the chip at 0x%lx\n",
120120
map->name, base, start);
@@ -124,9 +124,9 @@ static int __xipram cfi_probe_chip(struct map_info *map, __u32 base,
124124
* unfortunate. Stick the new chip in read mode
125125
* too and if it's the same, assume it's an alias. */
126126
/* FIXME: Use other modes to do a proper check */
127-
qry_mode_off(base, map, cfi);
127+
cfi_qry_mode_off(base, map, cfi);
128128

129-
if (qry_present(map, base, cfi)) {
129+
if (cfi_qry_present(map, base, cfi)) {
130130
xip_allowed(base, map);
131131
printk(KERN_DEBUG "%s: Found an alias at 0x%x for the chip at 0x%lx\n",
132132
map->name, base, start);
@@ -141,7 +141,7 @@ static int __xipram cfi_probe_chip(struct map_info *map, __u32 base,
141141
cfi->numchips++;
142142

143143
/* Put it back into Read Mode */
144-
qry_mode_off(base, map, cfi);
144+
cfi_qry_mode_off(base, map, cfi);
145145
xip_allowed(base, map);
146146

147147
printk(KERN_INFO "%s: Found %d x%d devices at 0x%x in %d-bit bank\n",
@@ -201,7 +201,7 @@ static int __xipram cfi_chip_setup(struct map_info *map,
201201
cfi_read_query(map, base + 0xf * ofs_factor);
202202

203203
/* Put it back into Read Mode */
204-
qry_mode_off(base, map, cfi);
204+
cfi_qry_mode_off(base, map, cfi);
205205
xip_allowed(base, map);
206206

207207
/* Do any necessary byteswapping */

drivers/mtd/chips/cfi_util.c

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
#include <linux/mtd/cfi.h>
2525
#include <linux/mtd/compatmac.h>
2626

27-
int __xipram qry_present(struct map_info *map, __u32 base,
28-
struct cfi_private *cfi)
27+
int __xipram cfi_qry_present(struct map_info *map, __u32 base,
28+
struct cfi_private *cfi)
2929
{
3030
int osf = cfi->interleave * cfi->device_type; /* scale factor */
3131
map_word val[3];
@@ -50,35 +50,39 @@ int __xipram qry_present(struct map_info *map, __u32 base,
5050

5151
return 1; /* "QRY" found */
5252
}
53+
EXPORT_SYMBOL_GPL(cfi_qry_present);
5354

54-
int __xipram qry_mode_on(uint32_t base, struct map_info *map,
55-
struct cfi_private *cfi)
55+
int __xipram cfi_qry_mode_on(uint32_t base, struct map_info *map,
56+
struct cfi_private *cfi)
5657
{
5758
cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL);
5859
cfi_send_gen_cmd(0x98, 0x55, base, map, cfi, cfi->device_type, NULL);
59-
if (qry_present(map, base, cfi))
60+
if (cfi_qry_present(map, base, cfi))
6061
return 1;
6162
/* QRY not found probably we deal with some odd CFI chips */
6263
/* Some revisions of some old Intel chips? */
6364
cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL);
6465
cfi_send_gen_cmd(0xFF, 0, base, map, cfi, cfi->device_type, NULL);
6566
cfi_send_gen_cmd(0x98, 0x55, base, map, cfi, cfi->device_type, NULL);
66-
if (qry_present(map, base, cfi))
67+
if (cfi_qry_present(map, base, cfi))
6768
return 1;
6869
/* ST M29DW chips */
6970
cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL);
7071
cfi_send_gen_cmd(0x98, 0x555, base, map, cfi, cfi->device_type, NULL);
71-
if (qry_present(map, base, cfi))
72+
if (cfi_qry_present(map, base, cfi))
7273
return 1;
7374
/* QRY not found */
7475
return 0;
7576
}
76-
void __xipram qry_mode_off(uint32_t base, struct map_info *map,
77-
struct cfi_private *cfi)
77+
EXPORT_SYMBOL_GPL(cfi_qry_mode_on);
78+
79+
void __xipram cfi_qry_mode_off(uint32_t base, struct map_info *map,
80+
struct cfi_private *cfi)
7881
{
7982
cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL);
8083
cfi_send_gen_cmd(0xFF, 0, base, map, cfi, cfi->device_type, NULL);
8184
}
85+
EXPORT_SYMBOL_GPL(cfi_qry_mode_off);
8286

8387
struct cfi_extquery *
8488
__xipram cfi_read_pri(struct map_info *map, __u16 adr, __u16 size, const char* name)
@@ -104,15 +108,15 @@ __xipram cfi_read_pri(struct map_info *map, __u16 adr, __u16 size, const char* n
104108
#endif
105109

106110
/* Switch it into Query Mode */
107-
qry_mode_on(base, map, cfi);
111+
cfi_qry_mode_on(base, map, cfi);
108112
/* Read in the Extended Query Table */
109113
for (i=0; i<size; i++) {
110114
((unsigned char *)extp)[i] =
111115
cfi_read_query(map, base+((adr+i)*ofs_factor));
112116
}
113117

114118
/* Make sure it returns to read mode */
115-
qry_mode_off(base, map, cfi);
119+
cfi_qry_mode_off(base, map, cfi);
116120

117121
#ifdef CONFIG_MTD_XIP
118122
(void) map_read(map, base);

include/linux/mtd/cfi.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -483,12 +483,12 @@ static inline void cfi_udelay(int us)
483483
}
484484
}
485485

486-
int __xipram qry_present(struct map_info *map, __u32 base,
487-
struct cfi_private *cfi);
488-
int __xipram qry_mode_on(uint32_t base, struct map_info *map,
489-
struct cfi_private *cfi);
490-
void __xipram qry_mode_off(uint32_t base, struct map_info *map,
491-
struct cfi_private *cfi);
486+
int __xipram cfi_qry_present(struct map_info *map, __u32 base,
487+
struct cfi_private *cfi);
488+
int __xipram cfi_qry_mode_on(uint32_t base, struct map_info *map,
489+
struct cfi_private *cfi);
490+
void __xipram cfi_qry_mode_off(uint32_t base, struct map_info *map,
491+
struct cfi_private *cfi);
492492

493493
struct cfi_extquery *cfi_read_pri(struct map_info *map, uint16_t adr, uint16_t size,
494494
const char* name);

0 commit comments

Comments
 (0)