2015-06-18 12:18:22

by Sudip Mukherjee

[permalink] [raw]
Subject: [PATCH v2 0/7] fix build failure of mn10300

Hi,
This is an attempt to fix the build failures when building mn10300 with
allmodconfig. As I have never worked with arch files so I hope you will
point me to right direction to correct my mistakes in this attempt.

regards
sudip

Sudip Mukherjee (7):
mn10300: fix build failure
mn10300: Provide dummy dma_alloc_attrs() and dma_free_attrs()
mmc: mediatek: build as module
USB: mos7720: rename DCR
samples: kdbus: disable for mn10300
mn10300: kgdb_arch_set_pc
mn10300: add early_init_dt_*

arch/mn10300/include/asm/dma-mapping.h | 13 +++++++++++++
arch/mn10300/include/asm/kprobes.h | 12 ++++++++++++
arch/mn10300/kernel/kgdb.c | 5 +++++
arch/mn10300/kernel/setup.c | 15 +++++++++++++++
drivers/mmc/host/mtk-sd.c | 1 +
drivers/usb/serial/mos7720.c | 16 ++++++++--------
samples/Kconfig | 2 +-
7 files changed, 55 insertions(+), 9 deletions(-)

--
1.8.1.2


2015-06-18 12:18:35

by Sudip Mukherjee

[permalink] [raw]
Subject: [PATCH v2 1/7] mn10300: fix build failure

allmodconfig build fails with the error:
invalid use of undefined type 'struct kprobe_ctlblk'

just declared the two basic structures after checking the struct in other
architectures.

Signed-off-by: Sudip Mukherjee <[email protected]>
---
arch/mn10300/include/asm/kprobes.h | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/arch/mn10300/include/asm/kprobes.h b/arch/mn10300/include/asm/kprobes.h
index c800b59..c90d2b1 100644
--- a/arch/mn10300/include/asm/kprobes.h
+++ b/arch/mn10300/include/asm/kprobes.h
@@ -47,4 +47,16 @@ extern int kprobe_exceptions_notify(struct notifier_block *self,

extern void arch_remove_kprobe(struct kprobe *p);

+struct prev_kprobe {
+ struct kprobe *kp;
+ unsigned long status;
+};
+
+struct kprobe_ctlblk {
+ unsigned int kprobe_status;
+ struct pt_regs jprobe_saved_regs;
+ char jprobes_stack[MAX_STACK_SIZE];
+ struct prev_kprobe prev_kprobe;
+};
+
#endif /* _ASM_KPROBES_H */
--
1.8.1.2

2015-06-18 12:20:43

by Sudip Mukherjee

[permalink] [raw]
Subject: [PATCH v2 2/7] mn10300: Provide dummy dma_alloc_attrs() and dma_free_attrs()

allmodconfig fails to build with following errors.

drivers/media/platform/sti/bdisp/bdisp-hw.c:
In function 'bdisp_hw_free_nodes':
drivers/media/platform/sti/bdisp/bdisp-hw.c:132:3: error:
implicit declaration of function 'dma_free_attrs'

drivers/media/platform/sti/bdisp/bdisp-hw.c:
In function 'bdisp_hw_alloc_nodes':
drivers/media/platform/sti/bdisp/bdisp-hw.c:157:2: error:
implicit declaration of function 'dma_alloc_attrs'

mn10300 does not provide those functions at this time.
Provide dummy implementations to avoid build errors.

Signed-off-by: Sudip Mukherjee <[email protected]>
---

copied from https://lkml.org/lkml/2015/4/22/346

arch/mn10300/include/asm/dma-mapping.h | 13 +++++++++++++
1 file changed, 13 insertions(+)

diff --git a/arch/mn10300/include/asm/dma-mapping.h b/arch/mn10300/include/asm/dma-mapping.h
index a18abfc..d589c5e 100644
--- a/arch/mn10300/include/asm/dma-mapping.h
+++ b/arch/mn10300/include/asm/dma-mapping.h
@@ -183,4 +183,17 @@ static inline int dma_get_sgtable(struct device *dev, struct sg_table *sgt,
return -EINVAL;
}

+static inline void *dma_alloc_attrs(struct device *dev, size_t size,
+ dma_addr_t *dma_handle, gfp_t flag,
+ struct dma_attrs *attrs)
+{
+ return NULL;
+}
+
+static inline void dma_free_attrs(struct device *dev, size_t size,
+ void *vaddr, dma_addr_t dma_handle,
+ struct dma_attrs *attrs)
+{
+}
+
#endif
--
1.8.1.2

2015-06-18 12:19:06

by Sudip Mukherjee

[permalink] [raw]
Subject: [PATCH v2 3/7] mmc: mediatek: build as module

while building as module with mn10300 it failed with:

warning: data definition has no type or storage class
module_init(__driver##_init);

Signed-off-by: Sudip Mukherjee <[email protected]>
---
drivers/mmc/host/mtk-sd.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c
index 7c20f28..ea6ae36 100644
--- a/drivers/mmc/host/mtk-sd.c
+++ b/drivers/mmc/host/mtk-sd.c
@@ -33,6 +33,7 @@
#include <linux/mmc/mmc.h>
#include <linux/mmc/sd.h>
#include <linux/mmc/sdio.h>
+#include <linux/module.h>

#define MAX_BD_NUM 1024

--
1.8.1.2

2015-06-18 12:19:12

by Sudip Mukherjee

[permalink] [raw]
Subject: [PATCH v2 4/7] USB: mos7720: rename DCR

While building with mn10300 it failed with:
error: expected identifier before '(' token
#define __SYSREG(ADDR, TYPE) (*(volatile TYPE *)(ADDR))
note: in expansion of macro '__SYSREG'
#define DCR __SYSREG(0xc0000030, u16) /* Debug control register */

mn10300 has a register named as DCR, so when this driver used an enum
named as DCR, build failed.
Just rename the DCR in the driver to parport_DCR.

Signed-off-by: Sudip Mukherjee <[email protected]>
---
drivers/usb/serial/mos7720.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
index 4f70df3..3263125 100644
--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -135,7 +135,7 @@ enum mos_regs {
DLM,
DPR, /* parallel port regs */
DSR,
- DCR,
+ parport_DCR,
ECR,
SP1_REG, /* device control regs */
SP2_REG, /* serial port 2 (7720 only) */
@@ -164,7 +164,7 @@ static inline __u16 get_reg_index(enum mos_regs reg)
0x01, /* DLM */
0x00, /* DPR */
0x01, /* DSR */
- 0x02, /* DCR */
+ 0x02, /* parport_DCR */
0x0a, /* ECR */
0x01, /* SP1_REG */
0x02, /* SP2_REG (7720 only) */
@@ -510,7 +510,7 @@ static void parport_mos7715_write_control(struct parport *pp, unsigned char d)
if (parport_prologue(pp) < 0)
return;
data = ((__u8)d & 0x0f) | (mos_parport->shadowDCR & 0xf0);
- write_mos_reg(mos_parport->serial, dummy, DCR, data);
+ write_mos_reg(mos_parport->serial, dummy, parport_DCR, data);
mos_parport->shadowDCR = data;
parport_epilogue(pp);
}
@@ -543,7 +543,7 @@ static unsigned char parport_mos7715_frob_control(struct parport *pp,
if (parport_prologue(pp) < 0)
return 0;
mos_parport->shadowDCR = (mos_parport->shadowDCR & (~mask)) ^ val;
- write_mos_reg(mos_parport->serial, dummy, DCR, mos_parport->shadowDCR);
+ write_mos_reg(mos_parport->serial, dummy, parport_DCR, mos_parport->shadowDCR);
dcr = mos_parport->shadowDCR & 0x0f;
parport_epilogue(pp);
return dcr;
@@ -581,7 +581,7 @@ static void parport_mos7715_data_forward(struct parport *pp)
return;
mos7715_change_mode(mos_parport, PS2);
mos_parport->shadowDCR &= ~0x20;
- write_mos_reg(mos_parport->serial, dummy, DCR, mos_parport->shadowDCR);
+ write_mos_reg(mos_parport->serial, dummy, parport_DCR, mos_parport->shadowDCR);
parport_epilogue(pp);
}

@@ -593,7 +593,7 @@ static void parport_mos7715_data_reverse(struct parport *pp)
return;
mos7715_change_mode(mos_parport, PS2);
mos_parport->shadowDCR |= 0x20;
- write_mos_reg(mos_parport->serial, dummy, DCR, mos_parport->shadowDCR);
+ write_mos_reg(mos_parport->serial, dummy, parport_DCR, mos_parport->shadowDCR);
parport_epilogue(pp);
}

@@ -633,7 +633,7 @@ static void parport_mos7715_restore_state(struct parport *pp,
spin_unlock(&release_lock);
return;
}
- write_parport_reg_nonblock(mos_parport, DCR, mos_parport->shadowDCR);
+ write_parport_reg_nonblock(mos_parport, parport_DCR, mos_parport->shadowDCR);
write_parport_reg_nonblock(mos_parport, ECR, mos_parport->shadowECR);
spin_unlock(&release_lock);
}
@@ -719,7 +719,7 @@ static int mos7715_parport_init(struct usb_serial *serial)

/* initialize device registers */
mos_parport->shadowDCR = DCR_INIT_VAL;
- write_mos_reg(mos_parport->serial, dummy, DCR, mos_parport->shadowDCR);
+ write_mos_reg(mos_parport->serial, dummy, parport_DCR, mos_parport->shadowDCR);
mos_parport->shadowECR = ECR_INIT_VAL;
write_mos_reg(mos_parport->serial, dummy, ECR, mos_parport->shadowECR);

--
1.8.1.2

2015-06-18 12:19:18

by Sudip Mukherjee

[permalink] [raw]
Subject: [PATCH v2 5/7] samples: kdbus: disable for mn10300

While building it failed with:
In function 'prime_new':
error: '__NR_memfd_create' undeclared (first use in this function)

memfd_create syscall has not yet been implemented for mn10300.
so disable compilation of samples/kdbus for now with mn10300.

Signed-off-by: Sudip Mukherjee <[email protected]>
---
samples/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/samples/Kconfig b/samples/Kconfig
index a4c6b2f..20c55af 100644
--- a/samples/Kconfig
+++ b/samples/Kconfig
@@ -57,7 +57,7 @@ config SAMPLE_KDB

config SAMPLE_KDBUS
bool "Build kdbus API example"
- depends on KDBUS
+ depends on KDBUS && !MN10300
help
Build an example of how the kdbus API can be used from
userspace.
--
1.8.1.2

2015-06-18 12:20:08

by Sudip Mukherjee

[permalink] [raw]
Subject: [PATCH v2 6/7] mn10300: kgdb_arch_set_pc

While building it failed with:
undefined reference to `kgdb_arch_set_pc'

Signed-off-by: Sudip Mukherjee <[email protected]>
---
arch/mn10300/kernel/kgdb.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/arch/mn10300/kernel/kgdb.c b/arch/mn10300/kernel/kgdb.c
index 9977082..8a0ae2b 100644
--- a/arch/mn10300/kernel/kgdb.c
+++ b/arch/mn10300/kernel/kgdb.c
@@ -499,3 +499,8 @@ void kgdb_roundup_cpus(unsigned long flags)
smp_jump_to_debugger();
}
#endif
+
+void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long ip)
+{
+ regs->pc = ip;
+}
--
1.8.1.2

2015-06-18 12:19:25

by Sudip Mukherjee

[permalink] [raw]
Subject: [PATCH v2 7/7] mn10300: add early_init_dt_*

While building it failed with:
undefined reference to `early_init_dt_alloc_memory_arch'
undefined reference to `early_init_dt_add_memory_arch'

Added the function after seeing them in x86.

Signed-off-by: Sudip Mukherjee <[email protected]>
---
arch/mn10300/kernel/setup.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)

diff --git a/arch/mn10300/kernel/setup.c b/arch/mn10300/kernel/setup.c
index 2ad7f32..f0e08b0 100644
--- a/arch/mn10300/kernel/setup.c
+++ b/arch/mn10300/kernel/setup.c
@@ -87,6 +87,21 @@ static int __init early_mem(char *p)
early_param("mem", early_mem);

/*
+ * early_init_dt_add_memory_arch() and early_init_dt_alloc_memory_arch()
+ * borrowed from arch/x86/kernel/devicetree.c
+ */
+
+void __init early_init_dt_add_memory_arch(u64 base, u64 size)
+{
+ BUG();
+}
+
+void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
+{
+ return __alloc_bootmem(size, align, 0);
+}
+
+/*
* architecture specific setup
*/
void __init setup_arch(char **cmdline_p)
--
1.8.1.2

2015-06-18 13:11:00

by Ulf Hansson

[permalink] [raw]
Subject: Re: [PATCH v2 3/7] mmc: mediatek: build as module

On 18 June 2015 at 14:17, Sudip Mukherjee <[email protected]> wrote:
> while building as module with mn10300 it failed with:
>
> warning: data definition has no type or storage class
> module_init(__driver##_init);
>
> Signed-off-by: Sudip Mukherjee <[email protected]>

Thanks for the patch. It's although already been fixed on my next branch.

Kind regards
Uffe

> ---
> drivers/mmc/host/mtk-sd.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c
> index 7c20f28..ea6ae36 100644
> --- a/drivers/mmc/host/mtk-sd.c
> +++ b/drivers/mmc/host/mtk-sd.c
> @@ -33,6 +33,7 @@
> #include <linux/mmc/mmc.h>
> #include <linux/mmc/sd.h>
> #include <linux/mmc/sdio.h>
> +#include <linux/module.h>
>
> #define MAX_BD_NUM 1024
>
> --
> 1.8.1.2
>

2015-06-18 14:40:01

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH v2 5/7] samples: kdbus: disable for mn10300

On Thu, Jun 18, 2015 at 05:47:51PM +0530, Sudip Mukherjee wrote:
> While building it failed with:
> In function 'prime_new':
> error: '__NR_memfd_create' undeclared (first use in this function)
>
> memfd_create syscall has not yet been implemented for mn10300.
> so disable compilation of samples/kdbus for now with mn10300.
>
> Signed-off-by: Sudip Mukherjee <[email protected]>
> ---
> samples/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/samples/Kconfig b/samples/Kconfig
> index a4c6b2f..20c55af 100644
> --- a/samples/Kconfig
> +++ b/samples/Kconfig
> @@ -57,7 +57,7 @@ config SAMPLE_KDB
>
> config SAMPLE_KDBUS
> bool "Build kdbus API example"
> - depends on KDBUS
> + depends on KDBUS && !MN10300

Why not just add the memfd syscall to this arch? I thought someone had
already sent such a patch in a while ago.

thanks,

greg k-h

2015-06-18 14:52:01

by Russell King - ARM Linux

[permalink] [raw]
Subject: Re: [PATCH v2 0/7] fix build failure of mn10300

On Thu, Jun 18, 2015 at 05:47:46PM +0530, Sudip Mukherjee wrote:
> This is an attempt to fix the build failures when building mn10300 with
> allmodconfig. As I have never worked with arch files so I hope you will
> point me to right direction to correct my mistakes in this attempt.

Why has the linux-arm-kernel mailing list been copied for something
which clearly has nothing to do with ARM? Am I missing something
in this series?

(Or is there a competition on to see who can add as many entries in
the Cc without getting caught by any filtering? :) )

--
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.

2015-06-18 16:15:05

by Sudip Mukherjee

[permalink] [raw]
Subject: Re: [PATCH v2 0/7] fix build failure of mn10300

On Thu, Jun 18, 2015 at 03:51:38PM +0100, Russell King - ARM Linux wrote:
> On Thu, Jun 18, 2015 at 05:47:46PM +0530, Sudip Mukherjee wrote:
> > This is an attempt to fix the build failures when building mn10300 with
> > allmodconfig. As I have never worked with arch files so I hope you will
> > point me to right direction to correct my mistakes in this attempt.
>
> Why has the linux-arm-kernel mailing list been copied for something
> which clearly has nothing to do with ARM? Am I missing something
> in this series?
get_maintainer.pl is giving linux-arm-kernel mailing list for
patch 3/7 ("mmc: mediatek: build as module").

regards
sudip

2015-06-18 16:19:26

by Sudip Mukherjee

[permalink] [raw]
Subject: Re: [PATCH v2 5/7] samples: kdbus: disable for mn10300

On Thu, Jun 18, 2015 at 07:39:58AM -0700, Greg Kroah-Hartman wrote:
> On Thu, Jun 18, 2015 at 05:47:51PM +0530, Sudip Mukherjee wrote:
> > While building it failed with:
> > In function 'prime_new':
> > error: '__NR_memfd_create' undeclared (first use in this function)
> >
> > memfd_create syscall has not yet been implemented for mn10300.
> > so disable compilation of samples/kdbus for now with mn10300.
> >
> > Signed-off-by: Sudip Mukherjee <[email protected]>
> > ---
> > samples/Kconfig | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/samples/Kconfig b/samples/Kconfig
> > index a4c6b2f..20c55af 100644
> > --- a/samples/Kconfig
> > +++ b/samples/Kconfig
> > @@ -57,7 +57,7 @@ config SAMPLE_KDB
> >
> > config SAMPLE_KDBUS
> > bool "Build kdbus API example"
> > - depends on KDBUS
> > + depends on KDBUS && !MN10300
>
> Why not just add the memfd syscall to this arch?
Yes, I intend to. But for now this will fix allmodconfig.
>I thought someone had already sent such a patch in a while ago.
Then it is still not merged. :(
I will try to find that patch adding memfd syscall. And if i find it whom
shall I forward it to?

regards
sudip

2015-06-18 16:25:14

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH v2 5/7] samples: kdbus: disable for mn10300

On Thu, Jun 18, 2015 at 09:49:05PM +0530, Sudip Mukherjee wrote:
> On Thu, Jun 18, 2015 at 07:39:58AM -0700, Greg Kroah-Hartman wrote:
> > On Thu, Jun 18, 2015 at 05:47:51PM +0530, Sudip Mukherjee wrote:
> > > While building it failed with:
> > > In function 'prime_new':
> > > error: '__NR_memfd_create' undeclared (first use in this function)
> > >
> > > memfd_create syscall has not yet been implemented for mn10300.
> > > so disable compilation of samples/kdbus for now with mn10300.
> > >
> > > Signed-off-by: Sudip Mukherjee <[email protected]>
> > > ---
> > > samples/Kconfig | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/samples/Kconfig b/samples/Kconfig
> > > index a4c6b2f..20c55af 100644
> > > --- a/samples/Kconfig
> > > +++ b/samples/Kconfig
> > > @@ -57,7 +57,7 @@ config SAMPLE_KDB
> > >
> > > config SAMPLE_KDBUS
> > > bool "Build kdbus API example"
> > > - depends on KDBUS
> > > + depends on KDBUS && !MN10300
> >
> > Why not just add the memfd syscall to this arch?
> Yes, I intend to. But for now this will fix allmodconfig.
> >I thought someone had already sent such a patch in a while ago.
> Then it is still not merged. :(
> I will try to find that patch adding memfd syscall. And if i find it whom
> shall I forward it to?

The maintainers of this arch.

2015-06-23 10:09:29

by Johan Hovold

[permalink] [raw]
Subject: Re: [PATCH v2 4/7] USB: mos7720: rename DCR

On Thu, Jun 18, 2015 at 05:47:50PM +0530, Sudip Mukherjee wrote:
> While building with mn10300 it failed with:
> error: expected identifier before '(' token
> #define __SYSREG(ADDR, TYPE) (*(volatile TYPE *)(ADDR))
> note: in expansion of macro '__SYSREG'
> #define DCR __SYSREG(0xc0000030, u16) /* Debug control register */
>
> mn10300 has a register named as DCR, so when this driver used an enum
> named as DCR, build failed.
> Just rename the DCR in the driver to parport_DCR.
>
> Signed-off-by: Sudip Mukherjee <[email protected]>
> ---
> drivers/usb/serial/mos7720.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
> index 4f70df3..3263125 100644
> --- a/drivers/usb/serial/mos7720.c
> +++ b/drivers/usb/serial/mos7720.c
> @@ -135,7 +135,7 @@ enum mos_regs {
> DLM,
> DPR, /* parallel port regs */
> DSR,
> - DCR,
> + parport_DCR,
> ECR,
> SP1_REG, /* device control regs */
> SP2_REG, /* serial port 2 (7720 only) */

Please use a MOS_ (or MOS7720_) prefix instead and add it to all the
registers.

Thanks,
Johan

2015-06-23 13:29:58

by Sudip Mukherjee

[permalink] [raw]
Subject: [PATCH v3] USB: mos7720: rename registers

Some of the register names defined here are matching with registers
defined in other places. Like DCR is defined here and DCR is also
a register in mn10300 architecture. So when we are building this with
mn10300, build fails.
To avoid we rename all the registers.

Signed-off-by: Sudip Mukherjee <[email protected]>
---

v3: renamed all registers with MOS7220_
v2: renamed only DCR

drivers/usb/serial/mos7720.c | 253 +++++++++++++++++++++++--------------------
1 file changed, 138 insertions(+), 115 deletions(-)

diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
index 4f70df3..78b4f64 100644
--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -121,26 +121,26 @@ static DEFINE_SPINLOCK(release_lock);
static const unsigned int dummy; /* for clarity in register access fns */

enum mos_regs {
- THR, /* serial port regs */
- RHR,
- IER,
- FCR,
- ISR,
- LCR,
- MCR,
- LSR,
- MSR,
- SPR,
- DLL,
- DLM,
- DPR, /* parallel port regs */
- DSR,
- DCR,
- ECR,
- SP1_REG, /* device control regs */
- SP2_REG, /* serial port 2 (7720 only) */
- PP_REG,
- SP_CONTROL_REG,
+ MOS7720_THR, /* serial port regs */
+ MOS7720_RHR,
+ MOS7720_IER,
+ MOS7720_FCR,
+ MOS7720_ISR,
+ MOS7720_LCR,
+ MOS7720_MCR,
+ MOS7720_LSR,
+ MOS7720_MSR,
+ MOS7720_SPR,
+ MOS7720_DLL,
+ MOS7720_DLM,
+ MOS7720_DPR, /* parallel port regs */
+ MOS7720_DSR,
+ MOS7720_DCR,
+ MOS7720_ECR,
+ MOS7720_SP1_REG, /* device control regs */
+ MOS7720_SP2_REG, /* serial port 2 (7720 only) */
+ MOS7720_PP_REG,
+ MOS7720_SP_CONTROL_REG,
};

/*
@@ -150,26 +150,26 @@ enum mos_regs {
static inline __u16 get_reg_index(enum mos_regs reg)
{
static const __u16 mos7715_index_lookup_table[] = {
- 0x00, /* THR */
- 0x00, /* RHR */
- 0x01, /* IER */
- 0x02, /* FCR */
- 0x02, /* ISR */
- 0x03, /* LCR */
- 0x04, /* MCR */
- 0x05, /* LSR */
- 0x06, /* MSR */
- 0x07, /* SPR */
- 0x00, /* DLL */
- 0x01, /* DLM */
- 0x00, /* DPR */
- 0x01, /* DSR */
- 0x02, /* DCR */
- 0x0a, /* ECR */
- 0x01, /* SP1_REG */
- 0x02, /* SP2_REG (7720 only) */
- 0x04, /* PP_REG (7715 only) */
- 0x08, /* SP_CONTROL_REG */
+ 0x00, /* MOS7720_THR */
+ 0x00, /* MOS7720_RHR */
+ 0x01, /* MOS7720_IER */
+ 0x02, /* MOS7720_FCR */
+ 0x02, /* MOS7720_ISR */
+ 0x03, /* MOS7720_LCR */
+ 0x04, /* MOS7720_MCR */
+ 0x05, /* MOS7720_LSR */
+ 0x06, /* MOS7720_MSR */
+ 0x07, /* MOS7720_SPR */
+ 0x00, /* MOS7720_DLL */
+ 0x01, /* MOS7720_DLM */
+ 0x00, /* MOS7720_DPR */
+ 0x01, /* MOS7720_DSR */
+ 0x02, /* MOS7720_DCR */
+ 0x0a, /* MOS7720_ECR */
+ 0x01, /* MOS7720_SP1_REG */
+ 0x02, /* MOS7720_SP2_REG (7720 only) */
+ 0x04, /* MOS7720_PP_REG (7715 only) */
+ 0x08, /* MOS7720_SP_CONTROL_REG */
};
return mos7715_index_lookup_table[reg];
}
@@ -181,10 +181,10 @@ static inline __u16 get_reg_index(enum mos_regs reg)
static inline __u16 get_reg_value(enum mos_regs reg,
unsigned int serial_portnum)
{
- if (reg >= SP1_REG) /* control reg */
+ if (reg >= MOS7720_SP1_REG) /* control reg */
return 0x0000;

- else if (reg >= DPR) /* parallel port reg (7715 only) */
+ else if (reg >= MOS7720_DPR) /* parallel port reg (7715 only) */
return 0x0100;

else /* serial port reg */
@@ -252,7 +252,8 @@ static inline int mos7715_change_mode(struct mos7715_parport *mos_parport,
enum mos7715_pp_modes mode)
{
mos_parport->shadowECR = mode;
- write_mos_reg(mos_parport->serial, dummy, ECR, mos_parport->shadowECR);
+ write_mos_reg(mos_parport->serial, dummy, MOS7720_ECR,
+ mos_parport->shadowECR);
return 0;
}

@@ -486,7 +487,7 @@ static void parport_mos7715_write_data(struct parport *pp, unsigned char d)
if (parport_prologue(pp) < 0)
return;
mos7715_change_mode(mos_parport, SPP);
- write_mos_reg(mos_parport->serial, dummy, DPR, (__u8)d);
+ write_mos_reg(mos_parport->serial, dummy, MOS7720_DPR, (__u8)d);
parport_epilogue(pp);
}

@@ -497,7 +498,7 @@ static unsigned char parport_mos7715_read_data(struct parport *pp)

if (parport_prologue(pp) < 0)
return 0;
- read_mos_reg(mos_parport->serial, dummy, DPR, &d);
+ read_mos_reg(mos_parport->serial, dummy, MOS7720_DPR, &d);
parport_epilogue(pp);
return d;
}
@@ -510,7 +511,7 @@ static void parport_mos7715_write_control(struct parport *pp, unsigned char d)
if (parport_prologue(pp) < 0)
return;
data = ((__u8)d & 0x0f) | (mos_parport->shadowDCR & 0xf0);
- write_mos_reg(mos_parport->serial, dummy, DCR, data);
+ write_mos_reg(mos_parport->serial, dummy, MOS7720_DCR, data);
mos_parport->shadowDCR = data;
parport_epilogue(pp);
}
@@ -543,7 +544,8 @@ static unsigned char parport_mos7715_frob_control(struct parport *pp,
if (parport_prologue(pp) < 0)
return 0;
mos_parport->shadowDCR = (mos_parport->shadowDCR & (~mask)) ^ val;
- write_mos_reg(mos_parport->serial, dummy, DCR, mos_parport->shadowDCR);
+ write_mos_reg(mos_parport->serial, dummy, MOS7720_DCR,
+ mos_parport->shadowDCR);
dcr = mos_parport->shadowDCR & 0x0f;
parport_epilogue(pp);
return dcr;
@@ -581,7 +583,8 @@ static void parport_mos7715_data_forward(struct parport *pp)
return;
mos7715_change_mode(mos_parport, PS2);
mos_parport->shadowDCR &= ~0x20;
- write_mos_reg(mos_parport->serial, dummy, DCR, mos_parport->shadowDCR);
+ write_mos_reg(mos_parport->serial, dummy, MOS7720_DCR,
+ mos_parport->shadowDCR);
parport_epilogue(pp);
}

@@ -593,7 +596,8 @@ static void parport_mos7715_data_reverse(struct parport *pp)
return;
mos7715_change_mode(mos_parport, PS2);
mos_parport->shadowDCR |= 0x20;
- write_mos_reg(mos_parport->serial, dummy, DCR, mos_parport->shadowDCR);
+ write_mos_reg(mos_parport->serial, dummy, MOS7720_DCR,
+ mos_parport->shadowDCR);
parport_epilogue(pp);
}

@@ -633,8 +637,10 @@ static void parport_mos7715_restore_state(struct parport *pp,
spin_unlock(&release_lock);
return;
}
- write_parport_reg_nonblock(mos_parport, DCR, mos_parport->shadowDCR);
- write_parport_reg_nonblock(mos_parport, ECR, mos_parport->shadowECR);
+ write_parport_reg_nonblock(mos_parport, MOS7720_DCR,
+ mos_parport->shadowDCR);
+ write_parport_reg_nonblock(mos_parport, MOS7720_ECR,
+ mos_parport->shadowECR);
spin_unlock(&release_lock);
}

@@ -714,14 +720,16 @@ static int mos7715_parport_init(struct usb_serial *serial)
init_completion(&mos_parport->syncmsg_compl);

/* cycle parallel port reset bit */
- write_mos_reg(mos_parport->serial, dummy, PP_REG, (__u8)0x80);
- write_mos_reg(mos_parport->serial, dummy, PP_REG, (__u8)0x00);
+ write_mos_reg(mos_parport->serial, dummy, MOS7720_PP_REG, (__u8)0x80);
+ write_mos_reg(mos_parport->serial, dummy, MOS7720_PP_REG, (__u8)0x00);

/* initialize device registers */
mos_parport->shadowDCR = DCR_INIT_VAL;
- write_mos_reg(mos_parport->serial, dummy, DCR, mos_parport->shadowDCR);
+ write_mos_reg(mos_parport->serial, dummy, MOS7720_DCR,
+ mos_parport->shadowDCR);
mos_parport->shadowECR = ECR_INIT_VAL;
- write_mos_reg(mos_parport->serial, dummy, ECR, mos_parport->shadowECR);
+ write_mos_reg(mos_parport->serial, dummy, MOS7720_ECR,
+ mos_parport->shadowECR);

/* register with parport core */
mos_parport->pp = parport_register_port(0, PARPORT_IRQ_NONE,
@@ -1033,45 +1041,49 @@ static int mos7720_open(struct tty_struct *tty, struct usb_serial_port *port)
/* Initialize MCS7720 -- Write Init values to corresponding Registers
*
* Register Index
- * 0 : THR/RHR
- * 1 : IER
- * 2 : FCR
- * 3 : LCR
- * 4 : MCR
- * 5 : LSR
- * 6 : MSR
- * 7 : SPR
+ * 0 : MOS7720_THR/MOS7720_RHR
+ * 1 : MOS7720_IER
+ * 2 : MOS7720_FCR
+ * 3 : MOS7720_LCR
+ * 4 : MOS7720_MCR
+ * 5 : MOS7720_LSR
+ * 6 : MOS7720_MSR
+ * 7 : MOS7720_SPR
*
* 0x08 : SP1/2 Control Reg
*/
port_number = port->port_number;
- read_mos_reg(serial, port_number, LSR, &data);
+ read_mos_reg(serial, port_number, MOS7720_LSR, &data);

dev_dbg(&port->dev, "SS::%p LSR:%x\n", mos7720_port, data);

- write_mos_reg(serial, dummy, SP1_REG, 0x02);
- write_mos_reg(serial, dummy, SP2_REG, 0x02);
+ write_mos_reg(serial, dummy, MOS7720_SP1_REG, 0x02);
+ write_mos_reg(serial, dummy, MOS7720_SP2_REG, 0x02);

- write_mos_reg(serial, port_number, IER, 0x00);
- write_mos_reg(serial, port_number, FCR, 0x00);
+ write_mos_reg(serial, port_number, MOS7720_IER, 0x00);
+ write_mos_reg(serial, port_number, MOS7720_FCR, 0x00);

- write_mos_reg(serial, port_number, FCR, 0xcf);
+ write_mos_reg(serial, port_number, MOS7720_FCR, 0xcf);
mos7720_port->shadowLCR = 0x03;
- write_mos_reg(serial, port_number, LCR, mos7720_port->shadowLCR);
+ write_mos_reg(serial, port_number, MOS7720_LCR,
+ mos7720_port->shadowLCR);
mos7720_port->shadowMCR = 0x0b;
- write_mos_reg(serial, port_number, MCR, mos7720_port->shadowMCR);
+ write_mos_reg(serial, port_number, MOS7720_MCR,
+ mos7720_port->shadowMCR);

- write_mos_reg(serial, port_number, SP_CONTROL_REG, 0x00);
- read_mos_reg(serial, dummy, SP_CONTROL_REG, &data);
+ write_mos_reg(serial, port_number, MOS7720_SP_CONTROL_REG, 0x00);
+ read_mos_reg(serial, dummy, MOS7720_SP_CONTROL_REG, &data);
data = data | (port->port_number + 1);
- write_mos_reg(serial, dummy, SP_CONTROL_REG, data);
+ write_mos_reg(serial, dummy, MOS7720_SP_CONTROL_REG, data);
mos7720_port->shadowLCR = 0x83;
- write_mos_reg(serial, port_number, LCR, mos7720_port->shadowLCR);
- write_mos_reg(serial, port_number, THR, 0x0c);
- write_mos_reg(serial, port_number, IER, 0x00);
+ write_mos_reg(serial, port_number, MOS7720_LCR,
+ mos7720_port->shadowLCR);
+ write_mos_reg(serial, port_number, MOS7720_THR, 0x0c);
+ write_mos_reg(serial, port_number, MOS7720_IER, 0x00);
mos7720_port->shadowLCR = 0x03;
- write_mos_reg(serial, port_number, LCR, mos7720_port->shadowLCR);
- write_mos_reg(serial, port_number, IER, 0x0c);
+ write_mos_reg(serial, port_number, MOS7720_LCR,
+ mos7720_port->shadowLCR);
+ write_mos_reg(serial, port_number, MOS7720_IER, 0x0c);

response = usb_submit_urb(port->read_urb, GFP_KERNEL);
if (response)
@@ -1144,8 +1156,8 @@ static void mos7720_close(struct usb_serial_port *port)
usb_kill_urb(port->write_urb);
usb_kill_urb(port->read_urb);

- write_mos_reg(serial, port->port_number, MCR, 0x00);
- write_mos_reg(serial, port->port_number, IER, 0x00);
+ write_mos_reg(serial, port->port_number, MOS7720_MCR, 0x00);
+ write_mos_reg(serial, port->port_number, MOS7720_IER, 0x00);

mos7720_port->open = 0;
}
@@ -1169,7 +1181,8 @@ static void mos7720_break(struct tty_struct *tty, int break_state)
data = mos7720_port->shadowLCR & ~UART_LCR_SBC;

mos7720_port->shadowLCR = data;
- write_mos_reg(serial, port->port_number, LCR, mos7720_port->shadowLCR);
+ write_mos_reg(serial, port->port_number, MOS7720_LCR,
+ mos7720_port->shadowLCR);
}

/*
@@ -1297,7 +1310,7 @@ static void mos7720_throttle(struct tty_struct *tty)
/* if we are implementing RTS/CTS, toggle that line */
if (tty->termios.c_cflag & CRTSCTS) {
mos7720_port->shadowMCR &= ~UART_MCR_RTS;
- write_mos_reg(port->serial, port->port_number, MCR,
+ write_mos_reg(port->serial, port->port_number, MOS7720_MCR,
mos7720_port->shadowMCR);
}
}
@@ -1327,7 +1340,7 @@ static void mos7720_unthrottle(struct tty_struct *tty)
/* if we are implementing RTS/CTS, toggle that line */
if (tty->termios.c_cflag & CRTSCTS) {
mos7720_port->shadowMCR |= UART_MCR_RTS;
- write_mos_reg(port->serial, port->port_number, MCR,
+ write_mos_reg(port->serial, port->port_number, MOS7720_MCR,
mos7720_port->shadowMCR);
}
}
@@ -1352,35 +1365,39 @@ static int set_higher_rates(struct moschip_port *mos7720_port,
dev_dbg(&port->dev, "Sending Setting Commands ..........\n");
port_number = port->port_number;

- write_mos_reg(serial, port_number, IER, 0x00);
- write_mos_reg(serial, port_number, FCR, 0x00);
- write_mos_reg(serial, port_number, FCR, 0xcf);
+ write_mos_reg(serial, port_number, MOS7720_IER, 0x00);
+ write_mos_reg(serial, port_number, MOS7720_FCR, 0x00);
+ write_mos_reg(serial, port_number, MOS7720_FCR, 0xcf);
mos7720_port->shadowMCR = 0x0b;
- write_mos_reg(serial, port_number, MCR, mos7720_port->shadowMCR);
- write_mos_reg(serial, dummy, SP_CONTROL_REG, 0x00);
+ write_mos_reg(serial, port_number, MOS7720_MCR,
+ mos7720_port->shadowMCR);
+ write_mos_reg(serial, dummy, MOS7720_SP_CONTROL_REG, 0x00);

/***********************************************
* Set for higher rates *
***********************************************/
/* writing baud rate verbatum into uart clock field clearly not right */
if (port_number == 0)
- sp_reg = SP1_REG;
+ sp_reg = MOS7720_SP1_REG;
else
- sp_reg = SP2_REG;
+ sp_reg = MOS7720_SP2_REG;
write_mos_reg(serial, dummy, sp_reg, baud * 0x10);
- write_mos_reg(serial, dummy, SP_CONTROL_REG, 0x03);
+ write_mos_reg(serial, dummy, MOS7720_SP_CONTROL_REG, 0x03);
mos7720_port->shadowMCR = 0x2b;
- write_mos_reg(serial, port_number, MCR, mos7720_port->shadowMCR);
+ write_mos_reg(serial, port_number, MOS7720_MCR,
+ mos7720_port->shadowMCR);

/***********************************************
* Set DLL/DLM
***********************************************/
mos7720_port->shadowLCR = mos7720_port->shadowLCR | UART_LCR_DLAB;
- write_mos_reg(serial, port_number, LCR, mos7720_port->shadowLCR);
- write_mos_reg(serial, port_number, DLL, 0x01);
- write_mos_reg(serial, port_number, DLM, 0x00);
+ write_mos_reg(serial, port_number, MOS7720_LCR,
+ mos7720_port->shadowLCR);
+ write_mos_reg(serial, port_number, MOS7720_DLL, 0x01);
+ write_mos_reg(serial, port_number, MOS7720_DLM, 0x00);
mos7720_port->shadowLCR = mos7720_port->shadowLCR & ~UART_LCR_DLAB;
- write_mos_reg(serial, port_number, LCR, mos7720_port->shadowLCR);
+ write_mos_reg(serial, port_number, MOS7720_LCR,
+ mos7720_port->shadowLCR);

return 0;
}
@@ -1488,15 +1505,16 @@ static int send_cmd_write_baud_rate(struct moschip_port *mos7720_port,

/* Enable access to divisor latch */
mos7720_port->shadowLCR = mos7720_port->shadowLCR | UART_LCR_DLAB;
- write_mos_reg(serial, number, LCR, mos7720_port->shadowLCR);
+ write_mos_reg(serial, number, MOS7720_LCR, mos7720_port->shadowLCR);

/* Write the divisor */
- write_mos_reg(serial, number, DLL, (__u8)(divisor & 0xff));
- write_mos_reg(serial, number, DLM, (__u8)((divisor & 0xff00) >> 8));
+ write_mos_reg(serial, number, MOS7720_DLL, (__u8)(divisor & 0xff));
+ write_mos_reg(serial, number, MOS7720_DLM,
+ (__u8)((divisor & 0xff00) >> 8));

/* Disable access to divisor latch */
mos7720_port->shadowLCR = mos7720_port->shadowLCR & ~UART_LCR_DLAB;
- write_mos_reg(serial, number, LCR, mos7720_port->shadowLCR);
+ write_mos_reg(serial, number, MOS7720_LCR, mos7720_port->shadowLCR);

return status;
}
@@ -1600,14 +1618,16 @@ static void change_port_settings(struct tty_struct *tty,


/* Disable Interrupts */
- write_mos_reg(serial, port_number, IER, 0x00);
- write_mos_reg(serial, port_number, FCR, 0x00);
- write_mos_reg(serial, port_number, FCR, 0xcf);
+ write_mos_reg(serial, port_number, MOS7720_IER, 0x00);
+ write_mos_reg(serial, port_number, MOS7720_FCR, 0x00);
+ write_mos_reg(serial, port_number, MOS7720_FCR, 0xcf);

/* Send the updated LCR value to the mos7720 */
- write_mos_reg(serial, port_number, LCR, mos7720_port->shadowLCR);
+ write_mos_reg(serial, port_number, MOS7720_LCR,
+ mos7720_port->shadowLCR);
mos7720_port->shadowMCR = 0x0b;
- write_mos_reg(serial, port_number, MCR, mos7720_port->shadowMCR);
+ write_mos_reg(serial, port_number, MOS7720_MCR,
+ mos7720_port->shadowMCR);

/* set up the MCR register and send it to the mos7720 */
mos7720_port->shadowMCR = UART_MCR_OUT2;
@@ -1619,14 +1639,17 @@ static void change_port_settings(struct tty_struct *tty,
/* To set hardware flow control to the specified *
* serial port, in SP1/2_CONTROL_REG */
if (port_number)
- write_mos_reg(serial, dummy, SP_CONTROL_REG, 0x01);
+ write_mos_reg(serial, dummy, MOS7720_SP_CONTROL_REG,
+ 0x01);
else
- write_mos_reg(serial, dummy, SP_CONTROL_REG, 0x02);
+ write_mos_reg(serial, dummy, MOS7720_SP_CONTROL_REG,
+ 0x02);

} else
mos7720_port->shadowMCR &= ~(UART_MCR_XONANY);

- write_mos_reg(serial, port_number, MCR, mos7720_port->shadowMCR);
+ write_mos_reg(serial, port_number, MOS7720_MCR,
+ mos7720_port->shadowMCR);

/* Determine divisor based on baud rate */
baud = tty_get_baud_rate(tty);
@@ -1639,7 +1662,7 @@ static void change_port_settings(struct tty_struct *tty,
if (baud >= 230400) {
set_higher_rates(mos7720_port, baud);
/* Enable Interrupts */
- write_mos_reg(serial, port_number, IER, 0x0c);
+ write_mos_reg(serial, port_number, MOS7720_IER, 0x0c);
return;
}

@@ -1650,7 +1673,7 @@ static void change_port_settings(struct tty_struct *tty,
if (cflag & CBAUD)
tty_encode_baud_rate(tty, baud, baud);
/* Enable Interrupts */
- write_mos_reg(serial, port_number, IER, 0x0c);
+ write_mos_reg(serial, port_number, MOS7720_IER, 0x0c);

if (port->read_urb->status != -EINPROGRESS) {
status = usb_submit_urb(port->read_urb, GFP_KERNEL);
@@ -1725,7 +1748,7 @@ static int get_lsr_info(struct tty_struct *tty,

count = mos7720_chars_in_buffer(tty);
if (count == 0) {
- read_mos_reg(port->serial, port_number, LSR, &data);
+ read_mos_reg(port->serial, port_number, MOS7720_LSR, &data);
if ((data & (UART_LSR_TEMT | UART_LSR_THRE))
== (UART_LSR_TEMT | UART_LSR_THRE)) {
dev_dbg(&port->dev, "%s -- Empty\n", __func__);
@@ -1782,7 +1805,7 @@ static int mos7720_tiocmset(struct tty_struct *tty,
mcr &= ~UART_MCR_LOOP;

mos7720_port->shadowMCR = mcr;
- write_mos_reg(port->serial, port->port_number, MCR,
+ write_mos_reg(port->serial, port->port_number, MOS7720_MCR,
mos7720_port->shadowMCR);

return 0;
@@ -1827,7 +1850,7 @@ static int set_modem_info(struct moschip_port *mos7720_port, unsigned int cmd,
}

mos7720_port->shadowMCR = mcr;
- write_mos_reg(port->serial, port->port_number, MCR,
+ write_mos_reg(port->serial, port->port_number, MOS7720_MCR,
mos7720_port->shadowMCR);

return 0;
@@ -1942,7 +1965,7 @@ static int mos7720_startup(struct usb_serial *serial)
}
#endif
/* LSR For Port 1 */
- read_mos_reg(serial, 0, LSR, &data);
+ read_mos_reg(serial, 0, MOS7720_LSR, &data);
dev_dbg(&dev->dev, "LSR:%x\n", data);

return 0;
--
1.8.1.2

2015-06-26 07:46:46

by Johan Hovold

[permalink] [raw]
Subject: Re: [PATCH v3] USB: mos7720: rename registers

On Tue, Jun 23, 2015 at 06:59:40PM +0530, Sudip Mukherjee wrote:
> Some of the register names defined here are matching with registers
> defined in other places. Like DCR is defined here and DCR is also
> a register in mn10300 architecture. So when we are building this with
> mn10300, build fails.
> To avoid we rename all the registers.
>
> Signed-off-by: Sudip Mukherjee <[email protected]>

Looks good. I'll queue this up for 4.2.

Thanks,
Johan

2015-06-26 13:57:38

by Sudip Mukherjee

[permalink] [raw]
Subject: Re: [PATCH v3] USB: mos7720: rename registers

On Fri, Jun 26, 2015 at 09:46:43AM +0200, Johan Hovold wrote:
> On Tue, Jun 23, 2015 at 06:59:40PM +0530, Sudip Mukherjee wrote:
> > Some of the register names defined here are matching with registers
> > defined in other places. Like DCR is defined here and DCR is also
> > a register in mn10300 architecture. So when we are building this with
> > mn10300, build fails.
> > To avoid we rename all the registers.
> >
> > Signed-off-by: Sudip Mukherjee <[email protected]>
>
> Looks good. I'll queue this up for 4.2.
Thanks Johan.

David,
This series works on next-20150618. But next-20150625 again fails in
allmodconfig of mn10300. I did a bisect and the first bad commit is:
db8786a2829c ("Merge remote-tracking branch 'dt-rh/for-next'").
And reverting it solved the problem. I will find out what was the exact
problem in that merge, but after I find out should i send a new series
or another patch?

regards
sudip

2015-07-10 11:21:09

by Sudip Mukherjee

[permalink] [raw]
Subject: Re: [PATCH v2 0/7] fix build failure of mn10300

On Thu, Jun 18, 2015 at 05:47:46PM +0530, Sudip Mukherjee wrote:
> Hi,
> This is an attempt to fix the build failures when building mn10300 with
> allmodconfig. As I have never worked with arch files so I hope you will
> point me to right direction to correct my mistakes in this attempt.
Even after applying this series allmodconfig of mn10300 is again failing
with error message like implicit declaration of function 'pci_iomap'.

And reverting b7d3282a245f ("net: via/Kconfig: replace USE_OF with OF_???")
fixes the problem and it builds again.

regards
sudip

2015-07-16 07:17:25

by Sudip Mukherjee

[permalink] [raw]
Subject: Re: [PATCH v2 1/7] mn10300: fix build failure

On Thu, Jun 18, 2015 at 05:47:47PM +0530, Sudip Mukherjee wrote:
> allmodconfig build fails with the error:
> invalid use of undefined type 'struct kprobe_ctlblk'
>
> just declared the two basic structures after checking the struct in other
> architectures.
Gentle ping.
next-20150716 still fails allmodconfig of mn10300 with
am33_2.0-linux-gcc version 4.9.0

regards
sudip

2015-07-16 21:54:29

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH v2 1/7] mn10300: fix build failure

On Thu, 18 Jun 2015 17:47:47 +0530 Sudip Mukherjee <[email protected]> wrote:

> allmodconfig build fails with the error:
> invalid use of undefined type 'struct kprobe_ctlblk'
>
> just declared the two basic structures after checking the struct in other
> architectures.
>
> --- a/arch/mn10300/include/asm/kprobes.h
> +++ b/arch/mn10300/include/asm/kprobes.h
> @@ -47,4 +47,16 @@ extern int kprobe_exceptions_notify(struct notifier_block *self,
>
> extern void arch_remove_kprobe(struct kprobe *p);
>
> +struct prev_kprobe {
> + struct kprobe *kp;
> + unsigned long status;
> +};
> +
> +struct kprobe_ctlblk {
> + unsigned int kprobe_status;
> + struct pt_regs jprobe_saved_regs;
> + char jprobes_stack[MAX_STACK_SIZE];
> + struct prev_kprobe prev_kprobe;
> +};
> +
> #endif /* _ASM_KPROBES_H */

Look:

akpm3:/usr/src/linux-4.2-rc2> grep -rl kprobe_ctlblk .
./arch/ia64/include/asm/kprobes.h
./arch/ia64/kernel/kprobes.c
./arch/tile/include/asm/kprobes.h
./arch/tile/kernel/kprobes.c
./arch/mips/include/asm/kprobes.h
./arch/mips/kernel/kprobes.c
./arch/arc/include/asm/kprobes.h
./arch/arc/kernel/kprobes.c
./arch/sparc/include/asm/kprobes.h
./arch/sparc/kernel/kprobes.c
./arch/powerpc/include/asm/kprobes.h
./arch/powerpc/kernel/kprobes.c
./arch/avr32/include/asm/kprobes.h
./arch/sh/include/asm/kprobes.h
./arch/sh/kernel/kprobes.c
./arch/arm/probes/kprobes/core.c
./arch/arm/probes/kprobes/opt-arm.c
./arch/arm/include/asm/kprobes.h
./arch/s390/include/asm/kprobes.h
./arch/s390/kernel/kprobes.c
./arch/x86/include/asm/kprobes.h
./arch/x86/kernel/kprobes/core.c
./arch/x86/kernel/kprobes/ftrace.c
./arch/x86/kernel/kprobes/common.h
./arch/x86/kernel/kprobes/opt.c
./include/linux/kprobes.h

mn10300 doesn't use kprobe_ctlblk (or prev_kprobe). Nor does the core
kernel kprobes code. So these are arch-specific things and shouldn't
be referenced from include/linux/kprobes.h at all. I think - I didn't
look super-closely at it.

So an appropriate fix for this would be to move the references to
prev_kprobe/kprobe_ctlblk out of include/linux/kprobes.h and into
asm/kprobes.h. Presumably via include/asm-generic/kprobes.h in some
fashion.

Have you tested this patch on mn10300? Does kprobes actually work on
mn10300? Perhaps not, and the solution here is to disable kprobes on
that arch until someone fixes it all up.


Please resend any mn10300 fixes which you still have pending. Please
be a bit more sparing in the cc's when doing so ;)

2015-07-17 05:06:20

by Sudip Mukherjee

[permalink] [raw]
Subject: Re: [PATCH v2 1/7] mn10300: fix build failure

On Thu, Jul 16, 2015 at 02:54:26PM -0700, Andrew Morton wrote:
> On Thu, 18 Jun 2015 17:47:47 +0530 Sudip Mukherjee <[email protected]> wrote:
>
>
> So an appropriate fix for this would be to move the references to
> prev_kprobe/kprobe_ctlblk out of include/linux/kprobes.h and into
> asm/kprobes.h. Presumably via include/asm-generic/kprobes.h in some
> fashion.
>
> Have you tested this patch on mn10300? Does kprobes actually work on
> mn10300? Perhaps not, and the solution here is to disable kprobes on
> that arch until someone fixes it all up.
No, this was not tested on board. :(
I tried my best to get a board but it seems board sellers in India have
not even heard the name of "mn10300". I tried contacting Koichi
Yasutake (one of the maintainer of mn10300) in hope of getting/buying
a board, but email of Koichi Yasutake is bouncing. I tried to contact
the company about one of their board and the following is their reply:
"As you say, linux runs on MN103E0700.
But MN103E0700 is now EOL, so we need not to maintenace linux."
:(
>
>
> Please resend any mn10300 fixes which you still have pending.
Should i resend as it is or should i fix according to your suggestion?
or since this is arch specific changes and not tested on board so if you
want it can be dropped also.

> Please be a bit more sparing in the cc's when doing so ;)
yes, cc became a long list but it was also improper to send some part of
the series to few maintainer and other to some other maintainers.

regards
sudip