QEMU-Devel Archive on lore.kernel.org
 help / color / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>,
	qemu-devel@nongnu.org, qemu-trivial@nongnu.org,
	hpoussin@reactos.org, qemu-ppc@nongnu.org, atar4qemu@gmail.com,
	david@gibson.dropbear.id.au
Subject: Re: [PATCH 5/5] m48t59: remove legacy m48t59_init() function
Date: Sat, 17 Oct 2020 11:53:57 +0200
Message-ID: <ad533302-e715-cc8a-12ec-d7e4ad75c120@amsat.org> (raw)
In-Reply-To: <20201016182739.22875-6-mark.cave-ayland@ilande.co.uk>

On 10/16/20 8:27 PM, Mark Cave-Ayland wrote:
> Now that all of the callers of this function have been switched to use qdev
> properties, this legacy init function can now be removed.
> 
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---
>   hw/rtc/m48t59.c         | 35 -----------------------------------
>   include/hw/rtc/m48t59.h |  4 ----
>   2 files changed, 39 deletions(-)

In the PoC I started after your suggestion, I see:

#define TYPE_M48T02_SRAM "sysbus-m48t02"
#define TYPE_M48T08_SRAM "sysbus-m48t08"
#define TYPE_M48T59_SRAM "sysbus-m48t59"

static void m48t02_class_init(ObjectClass *oc, void *data)
{
     M48txxSysBusDeviceClass *amc = M48TXX_SYS_BUS_CLASS(oc);

     amc->model = 2;
     amc->size = 2 * KiB;
};

static void m48t08_class_init(ObjectClass *oc, void *data)
{
     M48txxSysBusDeviceClass *amc = M48TXX_SYS_BUS_CLASS(oc);

     amc->model = 8;
     amc->size = 8 * KiB;
};

static void m48t59_class_init(ObjectClass *oc, void *data)
{
     M48txxSysBusDeviceClass *amc = M48TXX_SYS_BUS_CLASS(oc);

     amc->model = 59;
     amc->size = 8 * KiB;
};

static const TypeInfo m48t59_register_types[] = {
     {
         .name           = TYPE_M48T02_SRAM,
         .parent         = TYPE_M48TXX_SYSBUS,
         .class_init     = m48t02_class_init,
     }, {
         .name           = TYPE_M48T08_SRAM,
         .parent         = TYPE_M48TXX_SYSBUS,
         .class_init     = m48t08_class_init,
     }, {
         .name           = TYPE_M48T59_SRAM,
         .parent         = TYPE_M48TXX_SYSBUS,
         .class_init     = m48t59_class_init,
     }, {
         .name           = TYPE_M48TXX_SYSBUS,
         .parent         = TYPE_SYS_BUS_DEVICE,
         .instance_size  = sizeof(M48txxSysBusState),
         .instance_init = m48t59_init1,
         .class_size     = sizeof(M48txxSysBusDeviceClass),
         .class_init     = m48txx_sysbus_class_init,
         .abstract       = true,
         .interfaces = (InterfaceInfo[]) {
             { TYPE_NVRAM },
             { }
         }
     }
};

and:

#define TYPE_M48T59_SRAM "isa-m48t59"

static void m48t59_class_init(ObjectClass *oc, void *data)
{
     M48txxISADeviceClass *midc = M48TXX_ISA_CLASS(oc);

     midc->model = 59;
     midc->size = 8 * KiB;
};

static const TypeInfo m48t59_isa_register_types[] = {
     {
         .name           = TYPE_M48T59_SRAM,
         .parent         = TYPE_M48TXX_ISA,
         .class_init     = m48t59_class_init,
     }, {
         .name           = TYPE_M48TXX_ISA,
         .parent         = TYPE_ISA_DEVICE,
         .instance_size  = sizeof(M48txxISAState),
         .class_size     = sizeof(M48txxISADeviceClass),
         .class_init     = m48txx_isa_class_init,
         .abstract       = true,
         .interfaces = (InterfaceInfo[]) {
             { TYPE_NVRAM },
             { }
         }
     }
};

I guess I didn't pursue because I wondered what was the
best way to have the same model usable by sysbus/isa.

IIRC I wanted to proceed as having TYPE_M48T59_SRAM being
an abstract qdev parent, and then TYPE_M48TXX_SYSBUS /
TYPE_M48TXX_ISA implementing the SYSBUS/ISA interfaces.

As it need some thinking I postponed that for after 5.2.

Anyhow back to this patch:

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


  reply index

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-16 18:27 [PATCH 0/5] m48t59: remove legacy init functions Mark Cave-Ayland
2020-10-16 18:27 ` [PATCH 1/5] m48t59-isa: remove legacy m48t59_init_isa() function Mark Cave-Ayland
2020-10-17  9:39   ` Philippe Mathieu-Daudé
2020-10-16 18:27 ` [PATCH 2/5] sun4m: use qdev properties instead of legacy m48t59_init() function Mark Cave-Ayland
2020-10-17  9:42   ` Philippe Mathieu-Daudé
2020-10-17 11:07     ` Mark Cave-Ayland
2020-10-16 18:27 ` [PATCH 3/5] sun4u: " Mark Cave-Ayland
2020-10-17  9:43   ` Philippe Mathieu-Daudé
2020-10-16 18:27 ` [PATCH 4/5] ppc405_boards: " Mark Cave-Ayland
2020-10-16 20:38   ` BALATON Zoltan via
2020-10-17  9:45     ` Philippe Mathieu-Daudé
2020-10-17 10:44       ` BALATON Zoltan via
2020-10-17 11:53         ` Mark Cave-Ayland
2020-10-17 11:16       ` Mark Cave-Ayland
2020-10-17 14:41     ` Artyom Tarasenko
2020-10-16 18:27 ` [PATCH 5/5] m48t59: remove " Mark Cave-Ayland
2020-10-17  9:53   ` Philippe Mathieu-Daudé [this message]
2020-10-17 11:19     ` Mark Cave-Ayland
2020-10-17 13:57       ` Philippe Mathieu-Daudé
2020-10-16 20:21 ` [PATCH 0/5] m48t59: remove legacy init functions Hervé Poussineau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ad533302-e715-cc8a-12ec-d7e4ad75c120@amsat.org \
    --to=f4bug@amsat.org \
    --cc=atar4qemu@gmail.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=hpoussin@reactos.org \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

QEMU-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/qemu-devel/0 qemu-devel/git/0.git
	git clone --mirror https://lore.kernel.org/qemu-devel/1 qemu-devel/git/1.git
	git clone --mirror https://lore.kernel.org/qemu-devel/2 qemu-devel/git/2.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 qemu-devel qemu-devel/ https://lore.kernel.org/qemu-devel \
		qemu-devel@nongnu.org
	public-inbox-index qemu-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.nongnu.qemu-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git