diff options
24 files changed, 271 insertions, 122 deletions
diff --git a/README.patches b/README.patches index 9b81a75be..fda292912 100644 --- a/README.patches +++ b/README.patches @@ -86,6 +86,13 @@ sends a request the developers' mailing list and to the subsystem maintainer. The patches are analyzed and, if they look ok, merged into the master repository. +A script called hg-pull-req.pl is included that will generate this +request, providing a list of patches that will be pulled, links to each +patch, and a diffstat of the all patches. It will work best if Hg has +been configured with the correct username (also used by the commit +message generator) and push path. The script is designed to be easy to +modify to produce text for a given contributor's style. + It is good practice that each developer will have at least one tree called 'v4l-dvb', which keeps their patches, and periodically update this tree with the master tree's patches. diff --git a/linux/drivers/media/common/ir-functions.c b/linux/drivers/media/common/ir-functions.c index a15f5f34e..52b216fe6 100644 --- a/linux/drivers/media/common/ir-functions.c +++ b/linux/drivers/media/common/ir-functions.c @@ -115,21 +115,20 @@ void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir, } /* -------------------------------------------------------------------------- */ - +/* extract mask bits out of data and pack them into the result */ u32 ir_extract_bits(u32 data, u32 mask) { - int mbit, vbit; - u32 value; + u32 vbit = 1, value = 0; + + do { + if (mask&1) { + if (data&1) + value |= vbit; + vbit<<=1; + } + data>>=1; + } while (mask>>=1); - value = 0; - vbit = 0; - for (mbit = 0; mbit < 32; mbit++) { - if (!(mask & ((u32)1 << mbit))) - continue; - if (data & ((u32)1 << mbit)) - value |= (1 << vbit); - vbit++; - } return value; } diff --git a/linux/drivers/media/common/saa7146_core.c b/linux/drivers/media/common/saa7146_core.c index 06edb5fc1..a2ca9f1b8 100644 --- a/linux/drivers/media/common/saa7146_core.c +++ b/linux/drivers/media/common/saa7146_core.c @@ -27,7 +27,7 @@ static int saa7146_num; unsigned int saa7146_debug; -module_param(saa7146_debug, int, 0644); +module_param(saa7146_debug, uint, 0644); MODULE_PARM_DESC(saa7146_debug, "debug level (default: 0)"); #if 0 /* keep */ @@ -130,10 +130,10 @@ static struct scatterlist* vmalloc_to_sg(unsigned char *virt, int nr_pages) /********************************************************************************/ /* common page table functions */ -char *saa7146_vmalloc_build_pgtable(struct pci_dev *pci, long length, struct saa7146_pgtable *pt) +void *saa7146_vmalloc_build_pgtable(struct pci_dev *pci, long length, struct saa7146_pgtable *pt) { int pages = (length+PAGE_SIZE-1)/PAGE_SIZE; - char *mem = vmalloc_32(length); + void *mem = vmalloc_32(length); int slen = 0; if (NULL == mem) @@ -168,7 +168,7 @@ err_null: return NULL; } -void saa7146_vfree_destroy_pgtable(struct pci_dev *pci, char *mem, struct saa7146_pgtable *pt) +void saa7146_vfree_destroy_pgtable(struct pci_dev *pci, void *mem, struct saa7146_pgtable *pt) { pci_unmap_sg(pci, pt->slist, pt->nents, PCI_DMA_FROMDEVICE); saa7146_pgtable_free(pci, pt); diff --git a/linux/drivers/media/common/saa7146_video.c b/linux/drivers/media/common/saa7146_video.c index d3537ff4f..3f1fd24e0 100644 --- a/linux/drivers/media/common/saa7146_video.c +++ b/linux/drivers/media/common/saa7146_video.c @@ -890,9 +890,9 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int DEB_EE(("VIDIOC_QUERYCAP\n")); - strcpy(cap->driver, "saa7146 v4l2"); - strlcpy(cap->card, dev->ext->name, sizeof(cap->card)); - sprintf(cap->bus_info,"PCI:%s", pci_name(dev->pci)); + strcpy((char *)cap->driver, "saa7146 v4l2"); + strlcpy((char *)cap->card, dev->ext->name, sizeof(cap->card)); + sprintf((char *)cap->bus_info,"PCI:%s", pci_name(dev->pci)); cap->version = SAA7146_VERSION_CODE; cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | @@ -969,7 +969,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int } memset(f,0,sizeof(*f)); f->index = index; - strlcpy(f->description,formats[index].name,sizeof(f->description)); + strlcpy((char *)f->description,formats[index].name,sizeof(f->description)); f->pixelformat = formats[index].pixelformat; break; } diff --git a/linux/drivers/media/dvb/bt8xx/dst.c b/linux/drivers/media/dvb/bt8xx/dst.c index 0393a3d19..3036f8f12 100644 --- a/linux/drivers/media/dvb/bt8xx/dst.c +++ b/linux/drivers/media/dvb/bt8xx/dst.c @@ -1652,7 +1652,7 @@ static int dst_set_frontend(struct dvb_frontend *fe, struct dvb_frontend_paramet static int dst_tune_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters* p, unsigned int mode_flags, - int *delay, + unsigned int *delay, fe_status_t *status) { struct dst_state *state = fe->demodulator_priv; diff --git a/linux/drivers/media/dvb/dvb-core/dmxdev.c b/linux/drivers/media/dvb/dvb-core/dmxdev.c index 275df65fd..5394de2e4 100644 --- a/linux/drivers/media/dvb/dvb-core/dmxdev.c +++ b/linux/drivers/media/dvb/dvb-core/dmxdev.c @@ -97,7 +97,7 @@ static ssize_t dvb_dmxdev_buffer_read(struct dvb_ringbuffer *src, if (avail > todo) avail = todo; - ret = dvb_ringbuffer_read(src, buf, avail, 1); + ret = dvb_ringbuffer_read(src, (u8 *)buf, avail, 1); if (ret < 0) break; diff --git a/linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.c b/linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.c index 2a03bf53c..4fadddb26 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.c +++ b/linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.c @@ -175,7 +175,7 @@ static int dvb_ca_en50221_write_data(struct dvb_ca_private *ca, int slot, u8 * e * @param nlen Number of bytes in needle. * @return Pointer into haystack needle was found at, or NULL if not found. */ -static u8 *findstr(u8 * haystack, int hlen, u8 * needle, int nlen) +static char *findstr(char * haystack, int hlen, char * needle, int nlen) { int i; @@ -482,7 +482,7 @@ static int dvb_ca_en50221_parse_attributes(struct dvb_ca_private *ca, int slot) } /* check it contains the correct DVB string */ - dvb_str = findstr(tuple, tupleLength, "DVB_CI_V", 8); + dvb_str = findstr((char *)tuple, tupleLength, "DVB_CI_V", 8); if (dvb_str == NULL) return -EINVAL; if (tupleLength < ((dvb_str - (char *) tuple) + 12)) @@ -513,8 +513,8 @@ static int dvb_ca_en50221_parse_attributes(struct dvb_ca_private *ca, int slot) ca->slot_info[slot].config_option = tuple[0] & 0x3f; /* OK, check it contains the correct strings */ - if ((findstr(tuple, tupleLength, "DVB_HOST", 8) == NULL) || - (findstr(tuple, tupleLength, "DVB_CI_MODULE", 13) == NULL)) + if ((findstr((char *)tuple, tupleLength, "DVB_HOST", 8) == NULL) || + (findstr((char *)tuple, tupleLength, "DVB_CI_MODULE", 13) == NULL)) break; got_cftableentry = 1; @@ -1300,7 +1300,7 @@ static ssize_t dvb_ca_en50221_io_write(struct file *file, struct dvb_ca_private *ca = dvbdev->priv; u8 slot, connection_id; int status; - char fragbuf[HOST_LINK_BUF_SIZE]; + u8 fragbuf[HOST_LINK_BUF_SIZE]; int fragpos = 0; int fraglen; unsigned long timeout; @@ -1486,7 +1486,7 @@ static ssize_t dvb_ca_en50221_io_read(struct file *file, char __user * buf, } if ((status = dvb_ringbuffer_pkt_read(&ca->slot_info[slot].rx_buffer, idx, 2, - buf + pktlen, fraglen, 1)) < 0) { + (u8 *)buf + pktlen, fraglen, 1)) < 0) { goto exit; } pktlen += fraglen; diff --git a/linux/drivers/media/dvb/dvb-core/dvb_demux.c b/linux/drivers/media/dvb/dvb-core/dvb_demux.c index 6d8d1c3df..cb6987fce 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_demux.c +++ b/linux/drivers/media/dvb/dvb-core/dvb_demux.c @@ -1068,7 +1068,7 @@ static int dvbdmx_write(struct dmx_demux *demux, const char *buf, size_t count) if (mutex_lock_interruptible(&dvbdemux->mutex)) return -ERESTARTSYS; - dvb_dmx_swfilter(dvbdemux, buf, count); + dvb_dmx_swfilter(dvbdemux, (u8 *)buf, count); mutex_unlock(&dvbdemux->mutex); if (signal_pending(current)) diff --git a/linux/drivers/media/dvb/dvb-core/dvb_frontend.h b/linux/drivers/media/dvb/dvb-core/dvb_frontend.h index f233d78bc..a770a87b9 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.h +++ b/linux/drivers/media/dvb/dvb-core/dvb_frontend.h @@ -103,7 +103,7 @@ struct dvb_frontend_ops { int (*tune)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params, unsigned int mode_flags, - int *delay, + unsigned int *delay, fe_status_t *status); /* get frontend tuning algorithm from the module */ int (*get_frontend_algo)(struct dvb_frontend *fe); diff --git a/linux/drivers/media/dvb/dvb-core/dvb_net.c b/linux/drivers/media/dvb/dvb-core/dvb_net.c index e180cdf53..9d49c459c 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_net.c +++ b/linux/drivers/media/dvb/dvb-core/dvb_net.c @@ -360,7 +360,8 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len ) { struct dvb_net_priv *priv = dev->priv; unsigned long skipped = 0L; - u8 *ts, *ts_end, *from_where = NULL, ts_remain = 0, how_much = 0, new_ts = 1; + const u8 *ts, *ts_end, *from_where = NULL; + u8 ts_remain = 0, how_much = 0, new_ts = 1; struct ethhdr *ethh = NULL; #ifdef ULE_DEBUG @@ -377,7 +378,7 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len ) /* For all TS cells in current buffer. * Appearently, we are called for every single TS cell. */ - for (ts = (char *)buf, ts_end = (char *)buf + buf_len; ts < ts_end; /* no default incr. */ ) { + for (ts = buf, ts_end = buf + buf_len; ts < ts_end; /* no default incr. */ ) { if (new_ts) { /* We are about to process a new TS cell. */ diff --git a/linux/drivers/media/dvb/frontends/cx24123.c b/linux/drivers/media/dvb/frontends/cx24123.c index 173ce050b..a73a3fd5c 100644 --- a/linux/drivers/media/dvb/frontends/cx24123.c +++ b/linux/drivers/media/dvb/frontends/cx24123.c @@ -928,7 +928,7 @@ static int cx24123_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone) static int cx24123_tune(struct dvb_frontend* fe, struct dvb_frontend_parameters* params, unsigned int mode_flags, - int *delay, + unsigned int *delay, fe_status_t *status) { int retval = 0; diff --git a/linux/drivers/media/dvb/frontends/stv0299.c b/linux/drivers/media/dvb/frontends/stv0299.c index 18768d2f6..6c607302c 100644 --- a/linux/drivers/media/dvb/frontends/stv0299.c +++ b/linux/drivers/media/dvb/frontends/stv0299.c @@ -249,7 +249,7 @@ static int stv0299_get_symbolrate (struct stv0299_state* state) dprintk ("%s\n", __FUNCTION__); stv0299_readregs (state, 0x1f, sfr, 3); - stv0299_readregs (state, 0x1a, &rtf, 1); + stv0299_readregs (state, 0x1a, (u8 *)&rtf, 1); srate = (sfr[0] << 8) | sfr[1]; srate *= Mclk; diff --git a/linux/drivers/media/dvb/ttpci/av7110.c b/linux/drivers/media/dvb/ttpci/av7110.c index 3b31c294d..a070b48f9 100644 --- a/linux/drivers/media/dvb/ttpci/av7110.c +++ b/linux/drivers/media/dvb/ttpci/av7110.c @@ -137,6 +137,15 @@ static void init_av7110_av(struct av7110 *av7110) if (ret < 0) printk("dvb-ttpci:cannot set internal volume to maximum:%d\n",ret); + ret = av7110_fw_cmd(av7110, COMTYPE_ENCODER, SetMonitorType, + 1, (u16) av7110->display_ar); + if (ret < 0) + printk("dvb-ttpci: unable to set aspect ratio\n"); + ret = av7110_fw_cmd(av7110, COMTYPE_ENCODER, SetPanScanType, + 1, av7110->display_panscan); + if (ret < 0) + printk("dvb-ttpci: unable to set pan scan\n"); + ret = av7110_fw_cmd(av7110, COMTYPE_ENCODER, SetWSSConfig, 2, 2, wss_cfg_4_3); if (ret < 0) printk("dvb-ttpci: unable to configure 4:3 wss\n"); @@ -2639,12 +2648,12 @@ static int __devinit av7110_attach(struct saa7146_dev* dev, av7110->mixer.volume_left = volume; av7110->mixer.volume_right = volume; - init_av7110_av(av7110); - ret = av7110_register(av7110); if (ret < 0) goto err_arm_thread_stop_10; + init_av7110_av(av7110); + /* special case DVB-C: these cards have an analog tuner plus need some special handling, so we have separate saa7146_ext_vv data for these... */ diff --git a/linux/drivers/media/dvb/ttpci/av7110.h b/linux/drivers/media/dvb/ttpci/av7110.h index 38007f8a9..689b4ec22 100644 --- a/linux/drivers/media/dvb/ttpci/av7110.h +++ b/linux/drivers/media/dvb/ttpci/av7110.h @@ -210,6 +210,7 @@ struct av7110 { int video_blank; struct video_status videostate; + u16 display_panscan; int display_ar; int trickmode; #define TRICK_NONE 0 diff --git a/linux/drivers/media/dvb/ttpci/av7110_av.c b/linux/drivers/media/dvb/ttpci/av7110_av.c index 58678c05a..d75e7e48a 100644 --- a/linux/drivers/media/dvb/ttpci/av7110_av.c +++ b/linux/drivers/media/dvb/ttpci/av7110_av.c @@ -391,7 +391,7 @@ static int get_video_format(struct av7110 *av7110, u8 *buf, int count) ****************************************************************************/ static inline long aux_ring_buffer_write(struct dvb_ringbuffer *rbuf, - const char *buf, unsigned long count) + const u8 *buf, unsigned long count) { unsigned long todo = count; int free; @@ -436,7 +436,7 @@ static void play_audio_cb(u8 *buf, int count, void *priv) #define FREE_COND (dvb_ringbuffer_free(&av7110->avout) >= 20 * 1024 && \ dvb_ringbuffer_free(&av7110->aout) >= 20 * 1024) -static ssize_t dvb_play(struct av7110 *av7110, const u8 __user *buf, +static ssize_t dvb_play(struct av7110 *av7110, const char __user *buf, unsigned long count, int nonblock, int type) { unsigned long todo = count, n; @@ -499,7 +499,7 @@ static ssize_t dvb_play_kernel(struct av7110 *av7110, const u8 *buf, return count - todo; } -static ssize_t dvb_aplay(struct av7110 *av7110, const u8 __user *buf, +static ssize_t dvb_aplay(struct av7110 *av7110, const char __user *buf, unsigned long count, int nonblock, int type) { unsigned long todo = count, n; @@ -959,7 +959,7 @@ static u8 iframe_header[] = { 0x00, 0x00, 0x01, 0xe0, 0x00, 0x00, 0x80, 0x00, 0x #define MIN_IFRAME 400000 -static int play_iframe(struct av7110 *av7110, u8 __user *buf, unsigned int len, int nonblock) +static int play_iframe(struct av7110 *av7110, char __user *buf, unsigned int len, int nonblock) { int i, n; @@ -1082,19 +1082,18 @@ static int dvb_video_ioctl(struct inode *inode, struct file *file, case VIDEO_SET_DISPLAY_FORMAT: { video_displayformat_t format = (video_displayformat_t) arg; - u16 val = 0; switch (format) { case VIDEO_PAN_SCAN: - val = VID_PAN_SCAN_PREF; + av7110->display_panscan = VID_PAN_SCAN_PREF; break; case VIDEO_LETTER_BOX: - val = VID_VC_AND_PS_PREF; + av7110->display_panscan = VID_VC_AND_PS_PREF; break; case VIDEO_CENTER_CUT_OUT: - val = VID_CENTRE_CUT_PREF; + av7110->display_panscan = VID_CENTRE_CUT_PREF; break; default: @@ -1104,7 +1103,7 @@ static int dvb_video_ioctl(struct inode *inode, struct file *file, break; av7110->videostate.display_format = format; ret = av7110_fw_cmd(av7110, COMTYPE_ENCODER, SetPanScanType, - 1, (u16) val); + 1, av7110->display_panscan); break; } @@ -1466,8 +1465,9 @@ int av7110_av_register(struct av7110 *av7110) av7110->videostate.play_state = VIDEO_STOPPED; av7110->videostate.stream_source = VIDEO_SOURCE_DEMUX; av7110->videostate.video_format = VIDEO_FORMAT_4_3; - av7110->videostate.display_format = VIDEO_CENTER_CUT_OUT; + av7110->videostate.display_format = VIDEO_LETTER_BOX; av7110->display_ar = VIDEO_FORMAT_4_3; + av7110->display_panscan = VID_VC_AND_PS_PREF; init_waitqueue_head(&av7110->video_events.wait_queue); spin_lock_init(&av7110->video_events.lock); diff --git a/linux/drivers/media/dvb/ttpci/av7110_ca.c b/linux/drivers/media/dvb/ttpci/av7110_ca.c index e1c1294bb..c58e3fc50 100644 --- a/linux/drivers/media/dvb/ttpci/av7110_ca.c +++ b/linux/drivers/media/dvb/ttpci/av7110_ca.c @@ -151,7 +151,7 @@ static ssize_t ci_ll_write(struct dvb_ringbuffer *cibuf, struct file *file, { int free; int non_blocking = file->f_flags & O_NONBLOCK; - char *page = (char *)__get_free_page(GFP_USER); + u8 *page = (u8 *)__get_free_page(GFP_USER); int res; if (!page) @@ -208,7 +208,7 @@ static ssize_t ci_ll_read(struct dvb_ringbuffer *cibuf, struct file *file, return -EINVAL; DVB_RINGBUFFER_SKIP(cibuf, 2); - return dvb_ringbuffer_read(cibuf, buf, len, 1); + return dvb_ringbuffer_read(cibuf, (u8 *)buf, len, 1); } static int dvb_ca_open(struct inode *inode, struct file *file) diff --git a/linux/drivers/media/dvb/ttpci/av7110_hw.c b/linux/drivers/media/dvb/ttpci/av7110_hw.c index 55542b8c4..a731f0c52 100644 --- a/linux/drivers/media/dvb/ttpci/av7110_hw.c +++ b/linux/drivers/media/dvb/ttpci/av7110_hw.c @@ -158,7 +158,7 @@ static int load_dram(struct av7110 *av7110, u32 *data, int len) } dprintk(4, "writing DRAM block %d\n", i); mwdebi(av7110, DEBISWAB, bootblock, - ((char*)data) + i * AV7110_BOOT_MAX_SIZE, AV7110_BOOT_MAX_SIZE); + ((u8 *)data) + i * AV7110_BOOT_MAX_SIZE, AV7110_BOOT_MAX_SIZE); bootblock ^= 0x1400; iwdebi(av7110, DEBISWAB, AV7110_BOOT_BASE, swab32(base), 4); iwdebi(av7110, DEBINOSWAP, AV7110_BOOT_SIZE, AV7110_BOOT_MAX_SIZE, 2); @@ -173,10 +173,10 @@ static int load_dram(struct av7110 *av7110, u32 *data, int len) } if (rest > 4) mwdebi(av7110, DEBISWAB, bootblock, - ((char*)data) + i * AV7110_BOOT_MAX_SIZE, rest); + ((u8 *)data) + i * AV7110_BOOT_MAX_SIZE, rest); else mwdebi(av7110, DEBISWAB, bootblock, - ((char*)data) + i * AV7110_BOOT_MAX_SIZE - 4, rest + 4); + ((u8 *)data) + i * AV7110_BOOT_MAX_SIZE - 4, rest + 4); iwdebi(av7110, DEBISWAB, AV7110_BOOT_BASE, swab32(base), 4); iwdebi(av7110, DEBINOSWAP, AV7110_BOOT_SIZE, rest, 2); @@ -751,7 +751,7 @@ static int FlushText(struct av7110 *av7110) return 0; } -static int WriteText(struct av7110 *av7110, u8 win, u16 x, u16 y, u8* buf) +static int WriteText(struct av7110 *av7110, u8 win, u16 x, u16 y, char *buf) { int i, ret; unsigned long start; diff --git a/linux/drivers/media/dvb/ttpci/av7110_hw.h b/linux/drivers/media/dvb/ttpci/av7110_hw.h index 673d9b3f0..74d940f75 100644 --- a/linux/drivers/media/dvb/ttpci/av7110_hw.h +++ b/linux/drivers/media/dvb/ttpci/av7110_hw.h @@ -393,7 +393,7 @@ static inline void iwdebi(struct av7110 *av7110, u32 config, int addr, u32 val, } /* buffer writes */ -static inline void mwdebi(struct av7110 *av7110, u32 config, int addr, char *val, int count) +static inline void mwdebi(struct av7110 *av7110, u32 config, int addr, u8 *val, int count) { memcpy(av7110->debi_virt, val, count); av7110_debiwrite(av7110, config, addr, 0, count); diff --git a/linux/drivers/media/dvb/ttpci/av7110_v4l.c b/linux/drivers/media/dvb/ttpci/av7110_v4l.c index fcd999405..87afaebc0 100644 --- a/linux/drivers/media/dvb/ttpci/av7110_v4l.c +++ b/linux/drivers/media/dvb/ttpci/av7110_v4l.c @@ -333,7 +333,7 @@ static int av7110_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg) return -EINVAL; memset(t, 0, sizeof(*t)); - strcpy(t->name, "Television"); + strcpy((char *)t->name, "Television"); t->type = V4L2_TUNER_ANALOG_TV; t->capability = V4L2_TUNER_CAP_NORM | V4L2_TUNER_CAP_STEREO | diff --git a/linux/drivers/media/video/stradis.c b/linux/drivers/media/video/stradis.c index 22289cf95..6efcaeac0 100644 --- a/linux/drivers/media/video/stradis.c +++ b/linux/drivers/media/video/stradis.c @@ -1326,7 +1326,7 @@ static int saa_ioctl(struct inode *inode, struct file *file, u32 format; if (copy_from_user(&p, arg, sizeof(p))) return -EFAULT; - if (p.palette < sizeof(palette2fmt) / sizeof(u32)) { + if (p.palette < ARRAY_SIZE(palette2fmt)) { format = palette2fmt[p.palette]; saa->win.color_fmt = format; saawrite(format | 0x60, diff --git a/linux/drivers/media/video/v4l2-common.c b/linux/drivers/media/video/v4l2-common.c index 5f4094f21..eb6286bc4 100644 --- a/linux/drivers/media/video/v4l2-common.c +++ b/linux/drivers/media/video/v4l2-common.c @@ -456,11 +456,13 @@ static const char *v4l2_int_ioctls[] = { #define V4L2_INT_IOCTLS ARRAY_SIZE(v4l2_int_ioctls) #if 0 -static void v4l_print_pix_fmt (char *s, struct v4l2_pix_format *fmt) +static void v4l_print_pix_fmt(const char *s, const struct v4l2_pix_format *fmt) { - printk ("%s: width=%d, height=%d, format=%d, field=%s, " - "bytesperline=%d sizeimage=%d, colorspace=%d\n", s, - fmt->width,fmt->height,fmt->pixelformat, + printk ("%s: width=%d, height=%d, format=%c%c%c%c, field=%s, " + "bytesperline=%d, sizeimage=%d, colorspace=%d\n", s, + fmt->width,fmt->height, + fmt->pixelformat&0xff, (fmt->pixelformat>>8)&0xff, + (fmt->pixelformat>>16)&0xff, (fmt->pixelformat>>24)&0xff, prt_names(fmt->field,v4l2_field_names), fmt->bytesperline,fmt->sizeimage,fmt->colorspace); }; @@ -508,28 +510,28 @@ void v4l_printk_ioctl(unsigned int cmd) /* Common ioctl debug function. This function can be used by external ioctl messages as well as internal V4L ioctl and its arguments */ -void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) +void v4l_printk_ioctl_arg(const char *s, unsigned int cmd, const void *arg) { - printk(s); - printk(": "); + printk("%s: ", s); v4l_printk_ioctl(cmd); switch (cmd) { - case VIDIOC_INT_G_CHIP_IDENT: + case VIDIOC_G_CHIP_IDENT: { - enum v4l2_chip_ident *p=arg; - printk ("%s: chip ident=%d\n", s, *p); + const struct v4l2_chip_ident *p=arg; + printk("%s: chip_ident=%u, revision = 0x%x\n", s, + p->ident, p->revision); break; } case VIDIOC_G_PRIORITY: case VIDIOC_S_PRIORITY: { - enum v4l2_priority *p=arg; + const enum v4l2_priority *p=arg; printk ("%s: priority=%d\n", s, *p); break; } case VIDIOC_INT_S_TUNER_MODE: { - enum v4l2_tuner_type *p=arg; + const enum v4l2_tuner_type *p=arg; printk ("%s: tuner type=%d\n", s, *p); break; } @@ -559,7 +561,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) case VIDIOC_OVERLAY: case VIDIOC_S_INPUT: { - int *p=arg; + const int *p=arg; printk ("%s: value=%d\n", s, *p); break; } @@ -570,7 +572,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) case VIDIOC_G_AUDIO_OLD: #endif { - struct v4l2_audio *p=arg; + const struct v4l2_audio *p=arg; printk ("%s: index=%d, name=%s, capability=%d, mode=%d\n", s,p->index, p->name,p->capability, p->mode); @@ -583,7 +585,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) case VIDIOC_G_AUDOUT_OLD: #endif { - struct v4l2_audioout *p=arg; + const struct v4l2_audioout *p=arg; printk ("%s: index=%d, name=%s, capability=%d, mode=%d\n", s, p->index, p->name, p->capability,p->mode); break; @@ -592,8 +594,8 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) case VIDIOC_DQBUF: case VIDIOC_QUERYBUF: { - struct v4l2_buffer *p=arg; - struct v4l2_timecode *tc=&p->timecode; + const struct v4l2_buffer *p=arg; + const struct v4l2_timecode *tc=&p->timecode; printk ("%s: %02ld:%02d:%02d.%08ld index=%d, type=%s, " "bytesused=%d, flags=0x%08x, " "field=%0d, sequence=%d, memory=%s, offset/userptr=0x%08lx\n", @@ -616,7 +618,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) } case VIDIOC_QUERYCAP: { - struct v4l2_capability *p=arg; + const struct v4l2_capability *p=arg; printk ("%s: driver=%s, card=%s, bus=%s, version=0x%08x, " "capabilities=0x%08x\n", s, p->driver,p->card,p->bus_info, @@ -630,7 +632,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) case VIDIOC_S_CTRL_OLD: #endif { - struct v4l2_control *p=arg; + const struct v4l2_control *p=arg; printk ("%s: id=%d, value=%d\n", s, p->id, p->value); break; } @@ -638,7 +640,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) case VIDIOC_S_EXT_CTRLS: case VIDIOC_TRY_EXT_CTRLS: { - struct v4l2_ext_controls *p = arg; + const struct v4l2_ext_controls *p = arg; int i; printk("%s: ctrl_class=%d, count=%d\n", s, p->ctrl_class, p->count); @@ -654,7 +656,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) case VIDIOC_G_CROP: case VIDIOC_S_CROP: { - struct v4l2_crop *p=arg; + const struct v4l2_crop *p=arg; /*FIXME: Should also show rect structs */ printk ("%s: type=%d\n", s, p->type); break; @@ -664,14 +666,14 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) case VIDIOC_CROPCAP_OLD: #endif { - struct v4l2_cropcap *p=arg; + const struct v4l2_cropcap *p=arg; /*FIXME: Should also show rect structs */ printk ("%s: type=%d\n", s, p->type); break; } case VIDIOC_INT_DECODE_VBI_LINE: { - struct v4l2_decode_vbi_line *p=arg; + const struct v4l2_decode_vbi_line *p=arg; printk ("%s: is_second_field=%d, ptr=0x%08lx, line=%d, " "type=%d\n", s, p->is_second_field,(unsigned long)p->p,p->line,p->type); @@ -679,7 +681,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) } case VIDIOC_ENUM_FMT: { - struct v4l2_fmtdesc *p=arg; + const struct v4l2_fmtdesc *p=arg; printk ("%s: index=%d, type=%d, flags=%d, description=%s," " pixelformat=%d\n", s, p->index, p->type, p->flags,p->description, @@ -691,7 +693,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) case VIDIOC_S_FMT: case VIDIOC_TRY_FMT: { - struct v4l2_format *p=arg; + const struct v4l2_format *p=arg; printk ("%s: type=%s\n", s, prt_names(p->type,v4l2_type_names)); switch (p->type) { @@ -712,11 +714,12 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) default: break; } + break; } case VIDIOC_G_FBUF: case VIDIOC_S_FBUF: { - struct v4l2_framebuffer *p=arg; + const struct v4l2_framebuffer *p=arg; printk ("%s: capability=%d, flags=%d, base=0x%08lx\n", s, p->capability,p->flags, (unsigned long)p->base); v4l_print_pix_fmt (s, &p->fmt); @@ -725,14 +728,14 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) case VIDIOC_G_FREQUENCY: case VIDIOC_S_FREQUENCY: { - struct v4l2_frequency *p=arg; + const struct v4l2_frequency *p=arg; printk ("%s: tuner=%d, type=%d, frequency=%d\n", s, p->tuner,p->type,p->frequency); break; } case VIDIOC_ENUMINPUT: { - struct v4l2_input *p=arg; + const struct v4l2_input *p=arg; printk ("%s: index=%d, name=%s, type=%d, audioset=%d, " "tuner=%d, std=%Ld, status=%d\n", s, p->index,p->name,p->type,p->audioset, @@ -744,7 +747,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) case VIDIOC_G_JPEGCOMP: case VIDIOC_S_JPEGCOMP: { - struct v4l2_jpegcompression *p=arg; + const struct v4l2_jpegcompression *p=arg; printk ("%s: quality=%d, APPn=%d, APP_len=%d, COM_len=%d," " jpeg_markers=%d\n", s, p->quality,p->APPn,p->APP_len, @@ -754,7 +757,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) case VIDIOC_G_MODULATOR: case VIDIOC_S_MODULATOR: { - struct v4l2_modulator *p=arg; + const struct v4l2_modulator *p=arg; printk ("%s: index=%d, name=%s, capability=%d, rangelow=%d," " rangehigh=%d, txsubchans=%d\n", s, p->index, p->name,p->capability,p->rangelow, @@ -764,7 +767,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) case VIDIOC_G_MPEGCOMP: case VIDIOC_S_MPEGCOMP: { - struct v4l2_mpeg_compression *p=arg; + const struct v4l2_mpeg_compression *p=arg; /*FIXME: Several fields not shown */ printk ("%s: ts_pid_pmt=%d, ts_pid_audio=%d, ts_pid_video=%d, " "ts_pid_pcr=%d, ps_size=%d, au_sample_rate=%d, " @@ -779,7 +782,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) } case VIDIOC_ENUMOUTPUT: { - struct v4l2_output *p=arg; + const struct v4l2_output *p=arg; printk ("%s: index=%d, name=%s,type=%d, audioset=%d, " "modulator=%d, std=%Ld\n", s,p->index,p->name,p->type,p->audioset, @@ -789,7 +792,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) } case VIDIOC_QUERYCTRL: { - struct v4l2_queryctrl *p=arg; + const struct v4l2_queryctrl *p=arg; printk ("%s: id=%d, type=%d, name=%s, min/max=%d/%d," " step=%d, default=%d, flags=0x%08x\n", s, p->id,p->type,p->name,p->minimum,p->maximum, @@ -798,7 +801,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) } case VIDIOC_QUERYMENU: { - struct v4l2_querymenu *p=arg; + const struct v4l2_querymenu *p=arg; printk ("%s: id=%d, index=%d, name=%s\n", s, p->id,p->index,p->name); break; @@ -807,7 +810,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) case VIDIOC_DBG_G_REGISTER: case VIDIOC_DBG_S_REGISTER: { - struct v4l2_register *p=arg; + const struct v4l2_register *p=arg; printk ("%s: match_type=%d, match_chip=%d, reg=%llu, val=%llu\n", s, p->match_type, p->match_chip, (unsigned long long)p->reg, (unsigned long long)p->val); @@ -817,7 +820,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) #endif case VIDIOC_REQBUFS: { - struct v4l2_requestbuffers *p=arg; + const struct v4l2_requestbuffers *p=arg; printk ("%s: count=%d, type=%s, memory=%s\n", s, p->count, prt_names(p->type,v4l2_type_names), @@ -829,19 +832,19 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) case VIDIOC_INT_G_AUDIO_ROUTING: case VIDIOC_INT_G_VIDEO_ROUTING: { - struct v4l2_routing *p=arg; + const struct v4l2_routing *p=arg; printk ("%s: input=0x%x, output=0x%x\n", s, p->input, p->output); break; } case VIDIOC_INT_S_CRYSTAL_FREQ: { - struct v4l2_crystal_freq *p=arg; + const struct v4l2_crystal_freq *p=arg; printk ("%s: freq=%u, flags=0x%x\n", s, p->freq, p->flags); break; } case VIDIOC_G_SLICED_VBI_CAP: { - struct v4l2_sliced_vbi_cap *p=arg; + const struct v4l2_sliced_vbi_cap *p=arg; printk ("%s: service_set=%d\n", s, p->service_set); break; @@ -849,14 +852,14 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) case VIDIOC_INT_S_VBI_DATA: case VIDIOC_INT_G_VBI_DATA: { - struct v4l2_sliced_vbi_data *p=arg; + const struct v4l2_sliced_vbi_data *p=arg; printk ("%s: id=%d, field=%d, line=%d\n", s, p->id, p->field, p->line); break; } case VIDIOC_ENUMSTD: { - struct v4l2_standard *p=arg; + const struct v4l2_standard *p=arg; printk ("%s: index=%d, id=%Ld, name=%s, fps=%d/%d, " "framelines=%d\n", s, p->index, (unsigned long long)p->id, p->name, @@ -872,7 +875,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) case VIDIOC_S_PARM_OLD: #endif { - struct v4l2_streamparm *p=arg; + const struct v4l2_streamparm *p=arg; printk ("%s: type=%d\n", s, p->type); break; @@ -880,7 +883,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) case VIDIOC_G_TUNER: case VIDIOC_S_TUNER: { - struct v4l2_tuner *p=arg; + const struct v4l2_tuner *p=arg; printk ("%s: index=%d, name=%s, type=%d, capability=%d, " "rangelow=%d, rangehigh=%d, signal=%d, afc=%d, " "rxsubchans=%d, audmode=%d\n", s, @@ -894,7 +897,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) case VIDIOCGVBIFMT: case VIDIOCSVBIFMT: { - struct vbi_format *p=arg; + const struct vbi_format *p=arg; printk ("%s: sampling_rate=%d, samples_per_line=%d, " "sample_format=%d, start=%d/%d, count=%d/%d, flags=%d\n", s, p->sampling_rate,p->samples_per_line, @@ -905,7 +908,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) case VIDIOCGAUDIO: case VIDIOCSAUDIO: { - struct video_audio *p=arg; + const struct video_audio *p=arg; printk ("%s: audio=%d, volume=%d, bass=%d, treble=%d, " "flags=%d, name=%s, mode=%d, balance=%d, step=%d\n", s,p->audio,p->volume,p->bass, p->treble, @@ -915,7 +918,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) case VIDIOCGFBUF: case VIDIOCSFBUF: { - struct video_buffer *p=arg; + const struct video_buffer *p=arg; printk ("%s: base=%08lx, height=%d, width=%d, depth=%d, " "bytesperline=%d\n", s, (unsigned long) p->base, p->height, p->width, @@ -924,7 +927,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) } case VIDIOCGCAP: { - struct video_capability *p=arg; + const struct video_capability *p=arg; printk ("%s: name=%s, type=%d, channels=%d, audios=%d, " "maxwidth=%d, maxheight=%d, minwidth=%d, minheight=%d\n", s,p->name,p->type,p->channels,p->audios, @@ -936,7 +939,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) case VIDIOCGCAPTURE: case VIDIOCSCAPTURE: { - struct video_capture *p=arg; + const struct video_capture *p=arg; printk ("%s: x=%d, y=%d, width=%d, height=%d, decimation=%d," " flags=%d\n", s, p->x, p->y,p->width, p->height, @@ -946,7 +949,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) case VIDIOCGCHAN: case VIDIOCSCHAN: { - struct video_channel *p=arg; + const struct video_channel *p=arg; printk ("%s: channel=%d, name=%s, tuners=%d, flags=%d, " "type=%d, norm=%d\n", s, p->channel,p->name,p->tuners, @@ -956,27 +959,27 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) } case VIDIOCSMICROCODE: { - struct video_code *p=arg; + const struct video_code *p=arg; printk ("%s: loadwhat=%s, datasize=%d\n", s, p->loadwhat,p->datasize); break; } case DECODER_GET_CAPABILITIES: { - struct video_decoder_capability *p=arg; + const struct video_decoder_capability *p=arg; printk ("%s: flags=%d, inputs=%d, outputs=%d\n", s, p->flags,p->inputs,p->outputs); break; } case DECODER_INIT: { - struct video_decoder_init *p=arg; + const struct video_decoder_init *p=arg; printk ("%s: len=%c\n", s, p->len); break; } case VIDIOCGPLAYINFO: { - struct video_info *p=arg; + const struct video_info *p=arg; printk ("%s: frame_count=%d, h_size=%d, v_size=%d, " "smpte_timecode=%d, picture_type=%d, " "temporal_reference=%d, user_data=%s\n", s, @@ -988,14 +991,14 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) } case VIDIOCKEY: { - struct video_key *p=arg; + const struct video_key *p=arg; printk ("%s: key=%s, flags=%d\n", s, p->key, p->flags); break; } case VIDIOCGMBUF: { - struct video_mbuf *p=arg; + const struct video_mbuf *p=arg; printk ("%s: size=%d, frames=%d, offsets=0x%08lx\n", s, p->size, p->frames, @@ -1004,7 +1007,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) } case VIDIOCMCAPTURE: { - struct video_mmap *p=arg; + const struct video_mmap *p=arg; printk ("%s: frame=%d, height=%d, width=%d, format=%d\n", s, p->frame, p->height, p->width, @@ -1015,7 +1018,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) case VIDIOCSPICT: case DECODER_SET_PICTURE: { - struct video_picture *p=arg; + const struct video_picture *p=arg; printk ("%s: brightness=%d, hue=%d, colour=%d, contrast=%d," " whiteness=%d, depth=%d, palette=%d\n", s, @@ -1026,7 +1029,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) } case VIDIOCSPLAYMODE: { - struct video_play_mode *p=arg; + const struct video_play_mode *p=arg; printk ("%s: mode=%d, p1=%d, p2=%d\n", s, p->mode,p->p1,p->p2); break; @@ -1034,7 +1037,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) case VIDIOCGTUNER: case VIDIOCSTUNER: { - struct video_tuner *p=arg; + const struct video_tuner *p=arg; printk ("%s: tuner=%d, name=%s, rangelow=%ld, rangehigh=%ld, " "flags=%d, mode=%d, signal=%d\n", s, p->tuner, p->name,p->rangelow, p->rangehigh, @@ -1043,7 +1046,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) } case VIDIOCGUNIT: { - struct video_unit *p=arg; + const struct video_unit *p=arg; printk ("%s: video=%d, vbi=%d, radio=%d, audio=%d, " "teletext=%d\n", s, p->video,p->vbi,p->radio,p->audio,p->teletext); @@ -1052,7 +1055,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) case VIDIOCGWIN: case VIDIOCSWIN: { - struct video_window *p=arg; + const struct video_window *p=arg; printk ("%s: x=%d, y=%d, width=%d, height=%d, chromakey=%d," " flags=%d, clipcount=%d\n", s, p->x, p->y,p->width, p->height, @@ -1063,7 +1066,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) case VIDIOCGFREQ: case VIDIOCSFREQ: { - unsigned long *p=arg; + const unsigned long *p=arg; printk ("%s: value=%lu\n", s, *p); break; } @@ -1073,7 +1076,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) case VIDIOC_INT_S_STANDBY: case VIDIOC_INT_RESET: { - u32 *p=arg; + const u32 *p=arg; printk ("%s: value=%d\n", s, *p); break; @@ -1082,13 +1085,14 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) case VIDIOC_S_STD: case VIDIOC_QUERYSTD: { - v4l2_std_id *p=arg; + const v4l2_std_id *p=arg; printk ("%s: value=%Lu\n", s, (unsigned long long)*p); break; } } } +EXPORT_SYMBOL(v4l_printk_ioctl_arg); #endif /* 0 */ /* ----------------------------------------------------------------- */ diff --git a/linux/include/media/saa7146.h b/linux/include/media/saa7146.h index 1904940e3..ffc67e4b8 100644 --- a/linux/include/media/saa7146.h +++ b/linux/include/media/saa7146.h @@ -130,7 +130,7 @@ struct saa7146_dev #endif unsigned char __iomem *mem; /* pointer to mapped IO memory */ - int revision; /* chip revision; needed for bug-workarounds*/ + u32 revision; /* chip revision; needed for bug-workarounds*/ /* pci-device & irq stuff*/ char name[32]; @@ -181,8 +181,8 @@ struct saa7146_format* format_by_fourcc(struct saa7146_dev *dev, int fourcc); int saa7146_pgtable_alloc(struct pci_dev *pci, struct saa7146_pgtable *pt); void saa7146_pgtable_free(struct pci_dev *pci, struct saa7146_pgtable *pt); int saa7146_pgtable_build_single(struct pci_dev *pci, struct saa7146_pgtable *pt, struct scatterlist *list, int length ); -char *saa7146_vmalloc_build_pgtable(struct pci_dev *pci, long length, struct saa7146_pgtable *pt); -void saa7146_vfree_destroy_pgtable(struct pci_dev *pci, char *mem, struct saa7146_pgtable *pt); +void *saa7146_vmalloc_build_pgtable(struct pci_dev *pci, long length, struct saa7146_pgtable *pt); +void saa7146_vfree_destroy_pgtable(struct pci_dev *pci, void *mem, struct saa7146_pgtable *pt); void saa7146_setgpio(struct saa7146_dev *dev, int port, u32 data); int saa7146_wait_for_debi_done(struct saa7146_dev *dev, int nobusyloop); diff --git a/linux/include/media/v4l2-common.h b/linux/include/media/v4l2-common.h index 579835f92..3f6e53f72 100644 --- a/linux/include/media/v4l2-common.h +++ b/linux/include/media/v4l2-common.h @@ -69,6 +69,9 @@ /* Prints the ioctl in a human-readable format */ extern void v4l_printk_ioctl(unsigned int cmd); +#if 0 +extern void v4l_printk_ioctl_arg(const char *s, unsigned int cmd, const void *arg); +#endif /* Use this macro for non-I2C drivers. Pass the driver name as the first arg. */ #define v4l_print_ioctl(name, cmd) \ diff --git a/v4l/scripts/hg-pull-req.pl b/v4l/scripts/hg-pull-req.pl new file mode 100755 index 000000000..66de967eb --- /dev/null +++ b/v4l/scripts/hg-pull-req.pl @@ -0,0 +1,125 @@ +#!/usr/bin/perl + +# Copyright (C) 2006 Trent Piepho <xyzzy@speakeasy.org> +# Automatic pull request generator + +# Generates a pull request for all changesets in current Hg repository, that +# do not appear in a remote repository. +# +# There are _three_ repositories involved in this operation. +# +# The first is the remote repository that you want your changes to be pulled +# into. The default is the master repository at +# http://linuxtv.org/hg/v4l-dvb, but you can specify something else if you +# want. This repository is called the "to repo". +# +# The next two repositories should be copies of each other. The first is your +# local repository. You must run this script from some directory in that +# repository. The second repository is a remote copy on some public server, +# e.g. linuxtv.org. This is called the "from repo". The default for the from +# repo is the "default-push" path from the Hg configuration, which is where hg +# will push to if you don't specify a path to "hg push". The script will do +# some checks to make sure these two repositories are copies of each other. +# +# The repository used to the changesets are comming from is local repository, +# due to Mercurial's limitations. However, links to your local repository +# would be useless in a pull request, because no one else can see your local +# repository. So, the links are change to use the "from repo" instead. This +# is why your local repo and the from repo must be copies of each other. +# Running "hg push" before generating the pull request should be enough. + +$maintainer = 'Mauro'; +$to_repo = 'http://linuxtv.org/hg/v4l-dvb'; +# Default for when a default-push path wasn't defined +$from_repo_base = 'http://linuxtv.org/hg/~username/'; + +# What to open for the pull request +$output_file = '>&STDOUT'; +# Example, to a local file: '>pull_req' +# Example, file on remote host: '|ssh remote.host.com cat \\> pull_req' + +# Text of the pull request. $nstr is e.g. "changeset" or "42 changesets" +$salutation = <<'EOF'; +$maintainer, + +Please pull from $from_repo + +for the following $nstr: + +EOF + +# The closing of the request, name and fname taken from hg username setting +$valediction = <<'EOF'; + +Thanks, +$fname +EOF + +if($#ARGV < 0) { + if(`hg showconfig paths` =~ m/^paths\.default-push=(.*)$/m) { + $from_repo = $1; + $from_repo =~ s/^ssh:/http:/; + } else { + `hg root` =~ m|/([^/]+)\n$|; + my $repo = $1; + $from_repo = $from_repo_base . $repo; + } +} + +$from_repo = $ARGV[0] if($#ARGV >= 0); +$to_repo = $ARGV[1] if($#ARGV >= 1); + +open OUT, $output_file or die "Opening: $!"; + +if (`hg outgoing $from_repo` !~ /^no changes found$/m || + `hg incoming $from_repo` !~ /^no changes found$/m) { + my $cur = `hg root`; chomp $cur; + print "$cur and $from_repo do not match!\n"; + print "Prehaps you forgot to push your changes?\n"; + exit; +} + +open IN, "hg outgoing -M $to_repo |"; +while(<IN>) { + if(/^changeset:\s+\d+:([[:xdigit:]]{12})$/) { + push @changesets, $1; + } elsif(/^summary:\s+(\S.*)$/) { + if ($1 =~ /^merge:/) { + # Skip merge changesets + pop @changesets; + } else { + push @summaries, $1; + } + } +} +close IN; +$#changesets == $#summaries or die "Confused by hg outgoing output"; + +foreach (0 .. $#summaries) { + if($summaries[$_] =~ /^merge:/) { + splice @summaries, $_, 1; + splice @changesets, $_, 1; + } +} + +$n = $#changesets + 1; +$n > 0 or die "Nothing to pull!"; +$nstr = ($n==1)?"changeset":"$n changesets"; + +print OUT eval qq("$salutation"); + +for (0 .. $#summaries) { + printf OUT "%02d/%02d: $summaries[$_]\n", $_+1, $n; + print OUT "$from_repo?cmd=changeset;node=$changesets[$_]\n"; + print OUT "\n"; +} + +print OUT "\n"; + +open IN, 'hg export ' . join(' ', @changesets) . '| diffstat |'; +print OUT while(<IN>); +close IN; + +`hg showconfig ui.username` =~ m/((\S+).*)\s+</; +my $name = $1; my $fname = $2; +print OUT eval qq("$valediction"); |